Skip to content

Commit 21be2f9

Browse files
github-actions[bot]BohuTANG
authored andcommitted
💬Generate LLM translations
1 parent 2c9a594 commit 21be2f9

File tree

1 file changed

+130
-0
lines changed

1 file changed

+130
-0
lines changed
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
---
2+
title: 使用 Prometheus 跟踪指标
3+
---
4+
import StepsWrap from '@site/src/components/StepsWrap';
5+
import StepContent from '@site/src/components/Steps/step-content';
6+
7+
[Prometheus](https://prometheus.io/) 提供了一个强大的实时监控解决方案,使您能够有效跟踪关键指标并维护系统稳定性。本主题将指导您完成将 Prometheus 与 Databend Cloud 集成的步骤,并概述可用的指标。
8+
9+
:::note
10+
使用 Prometheus 跟踪指标仅适用于 Databend Cloud 的商业和专属计划用户。
11+
:::
12+
13+
## 与 Prometheus 集成
14+
15+
按照以下步骤使用 Docker 设置 Prometheus 实例并将其与 Databend Cloud 集成:
16+
17+
<StepsWrap>
18+
<StepContent number="1">
19+
20+
### 前提条件
21+
22+
- 要开始跟踪指标,请确保为您的 Databend Cloud 租户启用了指标。要启用此功能,请在 Databend Cloud 中导航到 **Support** > **Create New Ticket**,并请求为您的租户激活指标。
23+
24+
- 本过程说明如何使用 Docker 设置 Prometheus 实例。在继续之前,请确保您的机器上已安装 Docker Engine。
25+
26+
</StepContent>
27+
<StepContent number="2">
28+
29+
### 准备一个 SQL 用户
30+
31+
在 Databend Cloud 中为 Prometheus 创建一个专用的 SQL 用户以访问指标。例如,您可以使用以下 SQL 语句创建一个名为 `metrics` 且密码为 `metrics_password` 的 SQL 用户:
32+
33+
```sql
34+
CREATE USER metrics IDENTIFIED BY 'metrics_password';
35+
```
36+
37+
</StepContent>
38+
<StepContent number="3">
39+
40+
### 使用 Docker 启动 Prometheus
41+
42+
1. 在您的本地机器上,创建一个名为 **prometheus.yml** 的文件,以配置 Prometheus 从 Databend Cloud 抓取指标。使用以下模板:
43+
44+
```yaml title='prometheus.yml'
45+
scrape_configs:
46+
- job_name: databend-cloud
47+
scheme: https
48+
metrics_path: /metrics
49+
basic_auth:
50+
username: <USERNAME>
51+
password: <PASSWORD>
52+
scrape_interval: 10s
53+
scrape_timeout: 3s
54+
static_configs:
55+
- targets:
56+
- <TENANT_ENDPOINT>
57+
labels: # 可选
58+
tenant: <TENANT_ID>
59+
platform: <PLATFORM>
60+
region: <REGION>
61+
```
62+
63+
| 占位符 | 描述 | 示例 |
64+
|---------------------|-------------------------------------------|-----------------------------------------------------|
65+
| `<USERNAME>` | SQL 用户的用户名。 | `metrics` |
66+
| `<PASSWORD>` | SQL 用户的密码。 | `metrics_password` |
67+
| `<TENANT_ENDPOINT>` | Databend Cloud 租户的端点 URL。 | `tnxxxxxxx.gw.aws-us-east-2.default.databend.com` |
68+
| `<TENANT_ID>` | 租户的唯一标识符。 | `tnxxxxxxx` |
69+
| `<PLATFORM>` | 托管租户的云平台。 | `aws` |
70+
| `<REGION>` | 租户所在的区域。 | `us-east-2` |
71+
72+
2. 使用以下命令启动 Prometheus(将 `</path/to/prometheus.yml>` 替换为您的 **prometheus.yml** 文件的完整路径):
73+
74+
```bash
75+
docker run -d \
76+
--name prometheus \
77+
-p 9090:9090 \
78+
-v </path/to/prometheus.yml>:/etc/prometheus/prometheus.yml \
79+
prom/prometheus
80+
```
81+
82+
3. 在浏览器中打开 Prometheus,网址为 http://localhost:9090,导航到 **Status** > **Target health**,并确认 `databend-cloud` 目标已列出且状态为 `UP`。
83+
84+
![alt text](../../../../../static/img/documents/warehouses/metrics-1.png)
85+
86+
</StepContent>
87+
</StepsWrap>
88+
89+
您已准备就绪!现在可以直接从 Prometheus 查询您的租户指标。例如,尝试查询 `databend_cloud_warehouse_status`:
90+
91+
![alt text](../../../../../static/img/documents/warehouses/metrics-2.png)
92+
93+
## 可用指标列表
94+
95+
请注意,所有指标都以 `databend_cloud_` 为前缀。
96+
97+
### 查询指标
98+
99+
以下是 Databend Cloud 中可用的查询指标列表:
100+
101+
| 名称 | 类型 | 标签 | 描述 |
102+
|----------------------|---------|------------------|------------------------------|
103+
| query_count | Counter | tenant,warehouse | 客户端发起的查询次数 |
104+
| query_errors | Counter | tenant,warehouse | 客户端发起的查询错误次数 |
105+
| query_request_bytes | Counter | tenant,warehouse | 客户端查询请求的字节数 |
106+
| query_response_bytes | Counter | tenant,warehouse | 发送给客户端的查询响应字节数 |
107+
108+
### 存储指标
109+
110+
以下是 Databend Cloud 中可用的存储指标列表:
111+
112+
| 名称 | 类型 | 标签 | 描述 |
113+
|-------------------------------|-------|--------|------------------------------------------------|
114+
| storage_total_size | Guage | tenant | 后端对象存储的总大小 |
115+
| storage_staged_size | Guage | tenant | 后端对象存储中暂存文件的总大小 |
116+
| storage_table_compressed_size | Guage | tenant | 当前表的后端对象存储的总大小 |
117+
118+
### 计算集群指标
119+
120+
以下是 Databend Cloud 中可用的计算集群指标列表:
121+
122+
| 名称 | 类型 | 标签 | 描述 |
123+
|----------------------------------|---------|------------------------------|----------------------------------------------|
124+
| warehouse_status | Guage | tenant,warehouse,size,status | 计算集群状态的标志(挂起、运行等) |
125+
| warehouse_session_queued_queries | Guage | tenant,warehouse | 当前等待队列中的查询 |
126+
| warehouse_session_connections | Guage | tenant,warehouse | 当前会话数 |
127+
| warehouse_storage_requests_count | Counter | tenant,warehouse,scheme,op | 后端存储的请求次数 |
128+
| warehouse_storage_requests_bytes | Counter | tenant,warehouse,scheme,op | 后端存储的请求字节数 |
129+
| warehouse_data_scan_rows | Counter | tenant,warehouse | 从后端存储扫描的数据行数 |
130+
| warehouse_data_write_rows | Counter | tenant,warehouse | 写入后端存储的数据行数 |

0 commit comments

Comments
 (0)