Skip to content

Commit 1774d43

Browse files
authored
Merge branch 'main' into Blargian-patch-421813
2 parents 4afaa15 + c31d64b commit 1774d43

File tree

9,975 files changed

+386124
-247524
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

9,975 files changed

+386124
-247524
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## Community monitoring solutions {#community-monitoring}
2+
3+
The ClickHouse community has developed comprehensive monitoring solutions that integrate with popular observability stacks. [ClickHouse Monitoring](https://github.com/duyet/clickhouse-monitoring) provides a complete monitoring setup with pre-built dashboards. This open source project offers a quick-start approach for teams looking to implement ClickHouse monitoring with established best practices and proven dashboard configurations.
4+
5+
:::note
6+
Like other direct database monitoring approaches, this solution queries ClickHouse system tables directly, which prevents instances from idling and impacts cost optimization.
7+
:::
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import Image from '@theme/IdealImage';
2+
import AdvancedDashboard from '@site/static/images/cloud/manage/monitoring/advanced_dashboard.png';
3+
import NativeAdvancedDashboard from '@site/static/images/cloud/manage/monitoring/native_advanced_dashboard.png';
4+
5+
### Direct Grafana plugin integration {#direct-grafana}
6+
7+
The ClickHouse data source plugin for Grafana enables visualization and exploration of data directly from ClickHouse using system tables. This approach works well for monitoring performance and creating custom dashboards for detailed system analysis.
8+
For plugin installation and configuration details, see the ClickHouse [data source plugin](/integrations/grafana). For a complete monitoring setup using the Prometheus-Grafana mix-in with pre-built dashboards and alerting rules, see [Monitor ClickHouse with the new Prometheus-Grafana mix-in](https://clickhouse.com/blog/monitor-with-new-prometheus-grafana-mix-in).
9+
10+
### Direct Datadog Integration {#direct-datadog}
11+
12+
Datadog offers a Clickhouse Monitoring plugin for its agent which queries system tables directly. This integration provides comprehensive database monitoring with cluster awareness through clusterAllReplicas functionality.
13+
:::note
14+
This integration is not recommended for ClickHouse Cloud deployments due to incompatibility with cost-optimizing idle behavior and operational limitations of the cloud proxy layer.
15+
:::
16+
17+
### Using system tables directly {#system-tables}
18+
19+
Users can perform deep query performance analysis by connecting to ClickHouse system tables, particularly `system.query_log` and querying directly. Using either the SQL console or clickhouse client, teams can identify slow queries, analyze resource usage, and track usage patterns across the organization.
20+
21+
**Query Performance Analysis**
22+
23+
Users can use the system table query logs to perform Query Performance Analysis.
24+
25+
**Example query**: Find the top 5 long-running queries across all cluster replicas:
26+
27+
```sql
28+
SELECT
29+
type,
30+
event_time,
31+
query_duration_ms,
32+
query,
33+
read_rows,
34+
tables
35+
FROM clusterAllReplicas(default, system.query_log)
36+
WHERE event_time >= (now() - toIntervalMinute(60)) AND type='QueryFinish'
37+
ORDER BY query_duration_ms DESC
38+
LIMIT 5
39+
FORMAT VERTICAL
40+
```
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import Image from '@theme/IdealImage';
2+
import AdvancedDashboard from '@site/static/images/cloud/manage/monitoring/advanced_dashboard.png';
3+
import NativeAdvancedDashboard from '@site/static/images/cloud/manage/monitoring/native_advanced_dashboard.png';
4+
5+
## Integration examples {#examples}
6+
7+
External integration allows organizations to maintain established monitoring workflows, leverage existing team expertise with familiar tools, and integrate ClickHouse monitoring with broader infrastructure observability without disrupting current processes or requiring significant retraining investments.
8+
Teams can apply existing alerting rules and escalation procedures to ClickHouse metrics, while correlating database performance with application and infrastructure health within a unified observability platform. This approach maximizes ROI on current monitoring setups and enables faster troubleshooting through consolidated dashboards and familiar tooling interfaces.
9+
10+
### Grafana Cloud monitoring {#grafana}
11+
12+
Grafana provides ClickHouse monitoring through both direct plugin integration and Prometheus-based approaches. The Prometheus endpoint integration maintains operational separation between monitoring and production workloads while enabling visualization within existing Grafana Cloud infrastructure. See [Grafana's ClickHouse documentation](https://grafana.com/docs/grafana-cloud/monitor-infrastructure/integrations/integration-reference/integration-clickhouse/) for configuration guidance.
13+
14+
### Datadog monitoring {#datadog}
15+
Datadog is developing a dedicated API integration that will provide proper cloud service monitoring while respecting service idling behavior. In the interim, teams can use the OpenMetrics integration approach via ClickHouse Prometheus endpoints for operational separation and cost-efficient monitoring. For configuration guidance, see [Datadog's Prometheus and OpenMetrics integration documentation](https://docs.datadoghq.com/integrations/openmetrics/).
16+
17+
### ClickStack {#clickstack}
18+
19+
ClickStack is ClickHouse's recommended observability solution for deep system analysis and debugging, providing a unified platform for logs, metrics, and traces using ClickHouse as the storage engine. This approach relies on HyperDX, the ClickStack UI, connecting directly to the system tables inside your ClickHouse instance.
20+
HyperDX ships with a ClickHouse focused dashboard with tabs for Selects, Inserts, and Infrastructure. Teams can also use Lucene or SQL syntax to search system tables and logs, as well as create custom visualizations via Chart Explorer for detailed system analysis.
21+
This approach is ideal for debugging complex issues, performance analysis, and deep system introspection rather than real-time production alerting.
22+
23+
:::note
24+
Note that this approach will wake idle services as HyperDX queries the system tables directly.
25+
:::

docs/_snippets/_users-and-roles-common.md

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -120,49 +120,51 @@ With this set of examples:
120120

121121
Roles are used to define groups of users for certain privileges instead of managing each user separately.
122122

123-
1. Create a role to restrict users of this role to only see `column1` in database `db1` and `table1`:
123+
<VerticalStepper headerLevel="h5">
124+
125+
##### Create a role to restrict users of this role to only see `column1` in database `db1` and `table1`: {#create-column-role}
124126

125127
```sql
126128
CREATE ROLE column1_users;
127129
```
128130

129-
2. Set privileges to allow view on `column1`
131+
##### Set privileges to allow view on `column1` {#set-column-privileges}
130132

131133
```sql
132134
GRANT SELECT(id, column1) ON db1.table1 TO column1_users;
133135
```
134136

135-
3. Add the `column_user` user to the `column1_users` role
137+
##### Add the `column_user` user to the `column1_users` role {#add-column-user-to-role}
136138

137139
```sql
138140
GRANT column1_users TO column_user;
139141
```
140142

141-
4. Create a role to restrict users of this role to only see selected rows, in this case, only rows containing `A` in `column1`
143+
##### Create a role to restrict users of this role to only see selected rows, in this case, only rows containing `A` in `column1` {#create-row-role}
142144

143145
```sql
144146
CREATE ROLE A_rows_users;
145147
```
146148

147-
5. Add the `row_user` to the `A_rows_users` role
149+
##### Add the `row_user` to the `A_rows_users` role {#add-row-user-to-role}
148150

149151
```sql
150152
GRANT A_rows_users TO row_user;
151153
```
152154

153-
6. Create a policy to allow view on only where `column1` has the values of `A`
155+
##### Create a policy to allow view on only where `column1` has the values of `A` {#create-row-policy}
154156

155157
```sql
156158
CREATE ROW POLICY A_row_filter ON db1.table1 FOR SELECT USING column1 = 'A' TO A_rows_users;
157159
```
158160

159-
7. Set privileges to the database and table
161+
##### Set privileges to the database and table {#set-db-table-privileges}
160162

161163
```sql
162164
GRANT SELECT(id, column1, column2) ON db1.table1 TO A_rows_users;
163165
```
164166

165-
8. grant explicit permissions for other roles to still have access to all rows
167+
##### Grant explicit permissions for other roles to still have access to all rows {#grant-other-roles-access}
166168

167169
```sql
168170
CREATE ROW POLICY allow_other_users_filter
@@ -173,17 +175,21 @@ Roles are used to define groups of users for certain privileges instead of manag
173175
When attaching a policy to a table, the system will apply that policy, and only those users and roles defined will be able to do operations on the table, all others will be denied any operations. In order to not have the restrictive row policy applied to other users, another policy must be defined to allow other users and roles to have regular or other types of access.
174176
:::
175177

178+
</VerticalStepper>
179+
176180
## Verification {#verification}
177181

178182
### Testing role privileges with column restricted user {#testing-role-privileges-with-column-restricted-user}
179183

180-
1. Log into the clickhouse client using the `clickhouse_admin` user
184+
<VerticalStepper headerLevel="h5">
185+
186+
##### Log into the clickhouse client using the `clickhouse_admin` user {#login-admin-user}
181187

182188
```bash
183189
clickhouse-client --user clickhouse_admin --password password
184190
```
185191

186-
2. Verify access to database, table and all rows with the admin user.
192+
##### Verify access to database, table and all rows with the admin user. {#verify-admin-access}
187193

188194
```sql
189195
SELECT *
@@ -201,13 +207,13 @@ Roles are used to define groups of users for certain privileges instead of manag
201207
└────┴─────────┴─────────┘
202208
```
203209

204-
3. Log into the ClickHouse client using the `column_user` user
210+
##### Log into the ClickHouse client using the `column_user` user {#login-column-user}
205211

206212
```bash
207213
clickhouse-client --user column_user --password password
208214
```
209215

210-
4. Test `SELECT` using all columns
216+
##### Test `SELECT` using all columns {#test-select-all-columns}
211217

212218
```sql
213219
SELECT *
@@ -230,7 +236,7 @@ Roles are used to define groups of users for certain privileges instead of manag
230236
Access is denied since all columns were specified and the user only has access to `id` and `column1`
231237
:::
232238

233-
5. Verify `SELECT` query with only columns specified and allowed:
239+
##### Verify `SELECT` query with only columns specified and allowed: {#verify-allowed-columns}
234240

235241
```sql
236242
SELECT
@@ -250,15 +256,19 @@ Roles are used to define groups of users for certain privileges instead of manag
250256
└────┴─────────┘
251257
```
252258

259+
</VerticalStepper>
260+
253261
### Testing role privileges with row restricted user {#testing-role-privileges-with-row-restricted-user}
254262

255-
1. Log into the ClickHouse client using `row_user`
263+
<VerticalStepper headerLevel="h5">
264+
265+
##### Log into the ClickHouse client using `row_user` {#login-row-user}
256266

257267
```bash
258268
clickhouse-client --user row_user --password password
259269
```
260270

261-
2. View rows available
271+
##### View rows available {#view-available-rows}
262272

263273
```sql
264274
SELECT *
@@ -278,37 +288,41 @@ Roles are used to define groups of users for certain privileges instead of manag
278288
Verify that only the above two rows are returned, rows with the value `B` in `column1` should be excluded.
279289
:::
280290

291+
</VerticalStepper>
292+
281293
## Modifying users and roles {#modifying-users-and-roles}
282294

283295
Users can be assigned multiple roles for a combination of privileges needed. When using multiple roles, the system will combine the roles to determine privileges, the net effect will be that the role permissions will be cumulative.
284296

285297
For example, if one `role1` allows for only select on `column1` and `role2` allows for select on `column1` and `column2` then the user will have access to both columns.
286298

287-
1. Using the admin account, create new user to restrict by both row and column with default roles
299+
<VerticalStepper headerLevel="h5">
300+
301+
##### Using the admin account, create new user to restrict by both row and column with default roles {#create-restricted-user}
288302

289303
```sql
290304
CREATE USER row_and_column_user IDENTIFIED BY 'password' DEFAULT ROLE A_rows_users;
291305
```
292306

293-
2. Remove prior privileges for `A_rows_users` role
307+
##### Remove prior privileges for `A_rows_users` role {#remove-prior-privileges}
294308

295309
```sql
296310
REVOKE SELECT(id, column1, column2) ON db1.table1 FROM A_rows_users;
297311
```
298312

299-
3. Allow `A_row_users` role to only select from `column1`
313+
##### Allow `A_row_users` role to only select from `column1` {#allow-column1-select}
300314

301315
```sql
302316
GRANT SELECT(id, column1) ON db1.table1 TO A_rows_users;
303317
```
304318

305-
4. Log into the ClickHouse client using `row_and_column_user`
319+
##### Log into the ClickHouse client using `row_and_column_user` {#login-restricted-user}
306320

307321
```bash
308322
clickhouse-client --user row_and_column_user --password password;
309323
```
310324

311-
5. Test with all columns:
325+
##### Test with all columns: {#test-all-columns-restricted}
312326

313327
```sql
314328
SELECT *
@@ -327,7 +341,7 @@ For example, if one `role1` allows for only select on `column1` and `role2` allo
327341
SELECT(id, column1, column2) ON db1.table1. (ACCESS_DENIED)
328342
```
329343

330-
6. Test with limited allowed columns:
344+
##### Test with limited allowed columns: {#test-limited-columns}
331345

332346
```sql
333347
SELECT
@@ -344,6 +358,7 @@ For example, if one `role1` allows for only select on `column1` and `role2` allo
344358
│ 2 │ A │
345359
└────┴─────────┘
346360
```
361+
</VerticalStepper>
347362

348363
## Troubleshooting {#troubleshooting}
349364

0 commit comments

Comments
 (0)