提交 ef6f52da 编写于 作者: G gccgdb1234

docs: refine prometheus page

上级 783d5587
---
sidebar_label: Prometheus
title: Prometheus 远端读取/远端写入
title: Prometheus
---
import Prometheus from "../14-reference/_prometheus.mdx"
import DeployTaosAdapter from "./_deploytaosadapter.mdx"
Prometheus 是一款流行的开源监控告警系统。Prometheus 于2016年加入了 Cloud Native Computing Foundation (云原生云计算基金会,简称 CNCF),成为继 Kubernetes 之后的第二个托管项目,该项目拥有非常活跃的开发人员和用户社区。
Prometheus 的数据可以通过 remote_write 接口存储到 TDengine 中,也可以通过 remote_read 接口来查询存储在 TDengine 中的 Prometheus 数据,充分利用 TDengine 对时序数据的高效存储查询性能和集群处理能力。TDengine(2.4.0.0+)包含一个 taosAdapter 独立程序,可以接收包括 Prometheus 在内的多种应用的数据写入。只需要将 Prometheus 的 remote_read 和 remote_write url 指向 taosAdapter 对应的 url 同时设置 Basic 验证即可使用。
Prometheus 提供了 `remote_write``remote_read` 接口来利用其它数据库产品作为它的存储引擎。为了让 Prometheus 生态圈的用户能够利用 TDengine 的高效写入和查询,TDengine 也提供了对这两个接口的支持。
通过适当的配置, Prometheus 的数据可以通过 `remote_write` 接口存储到 TDengine 中,也可以通过 `remote_read` 接口来查询存储在 TDengine 中的数据,充分利用 TDengine 对时序数据的高效存储查询性能和集群处理能力。
安装 Prometheus 请参考[官方文档](https://prometheus.io/docs/prometheus/latest/installation/)
<DeployTaosAdapter />
## 前置条件
要将 Prometheus 数据写入 TDengine, 需要几方面的准备工作。
- TDengine 集群部署并正在运行
- taosAdapter 安装并正在运行, 具体细节请参考 [taosAdapter 的使用手册](/reference/taosadapter)
- Prometheus 已经安装
## 配置 Prometheus
<Prometheus />
## 验证方法
重启 Prometheus 后可参考以下示例验证从 Prometheus 向 TDengine 写入数据并能够正确读出。
```
这里需要给出 Prometheus 端 写入和查询 TDengine的示例
```
\ No newline at end of file
## taosAdapter 部署方法
### 部署taosAdapter
taosAdapter 可以和 TDengine 部署在同一个系统中,也可以分离部署。
......@@ -14,5 +14,5 @@ systemctl start taosadapter
systemctl status taosadapter
```
taosAdapter 相关配置参数请参考 `taosadapter --help` 命令输出以及相关文档
taosAdapter 详细的配置参数和使用请参考 `taosadapter --help` 命令输出以及 [参考文档](/reference/taosadapter)
## 配置 Prometheus
配置 Prometheus 是通过编辑 Prometheus 配置文件 prometheus.yml 完成的。
编辑 Prometheus 配置文件 prometheus.yml 中下列行:
### 配置第三方数据库地址
将其中的 remote_read 和 remote_write 指向 taosAdapter 的正确地址,并确保 相应的 URL 配置如下
- remote_read url : `http://host_to_taosAdapter:port(default 6041)/prometheus/v1/remote_read/:db`
- remote_write url : `http://host_to_taosAdapter:port(default 6041)/prometheus/v1/remote_write/:db`
Basic 验证配置:
### 配置 Basic 验证
- username: TDengine 连接用户名
- password: TDengine 连接密码
示例 prometheus.yml 如下:
### 示例
```yaml
remote_write:
......@@ -27,8 +29,3 @@ remote_read:
remote_timeout: 10s
read_recent: true
```
## 验证方法
重启 Prometheus 后可通过查询 TDengine 中的 metrics 数据库来验证 Prometheus 写入的数据。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册