Prometheus + Clickhouse + Grafana 架構安裝

1. 安裝 Prometheus

Prometheus 生態


由于原生 tsdb 性能的限制,經過性能測試選用 Clickhouse 作為第三方數據庫,提升其大數據讀寫性能

1)下載并解壓

wget https://github.com/prometheus/prometheus/releases/download/v2.3.2/prometheus-2.3.2.linux-amd64.tar.gz

tar -xvf prometheus-2.3.2.linux-amd64.tar.gz

2)進入并執行

cd?prometheus-2.3.2.linux-amd64

./prometheus (調試時使用)

nohup ./prometheus --config.file=prometheus.yml & (正常運行時使用)

3)安裝 node_exporter

wget https://github.com/prometheus/node_exporter/releases/download/v0.16.0-rc.3/node_exporter-0.16.0-rc.3.linux-amd64.tar.gz

tar xzf node_exporter-0.16.0-rc.3.linux-amd64.tar.gz

4)進入并運行

cd node_exporter-0.16.0-rc.3.linux-amd64

./node_exporter (調試時使用)

nohup ./node_exporter > out.log & (正常運行時使用)

5)配置Prometheus文件

添加如下到 prometheus.yml

# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.

- job_name: 'node_exporter'

# metrics_path defaults to '/metrics'

# scheme defaults to 'http'.

static_configs:

- targets: ['localhost:9100']

( localhost 請自行根據上報服務器填寫ip)

6)重啟 Prometheus 獲得數據,UI頁面為 ip:9090 端口


2. 安裝 Clickhouse?

關于Clickhouse請參考 pigness.com.cn 的?clickhouse 安裝

更詳細的參考資料:ClickHouse集群搭建從0到1?


3. 安裝 prom2Click (在此感謝軍哥對于此部分的指導)

1)github 位置?https://github.com/iyacontrol/prom2click

具體步驟請參考 prom2click 的 Readme文檔

2)在 prometheus.yml 添加第三方讀寫功能

remote_write:

- url: "http://localhost:9201/write"

remote_read:

- url: "http://localhost:9201/read"?

3)重啟 Prometheus 讓配置生效

注:當遇到 golang.org/x 中 文件無法下載的情況時,請參考 https://studygolang.com/articles/10797


4. 安裝 Grafana

Grafana官網(https://grafana.com/),上面有各個系統安裝的步驟,我的mac是直接通過brew安裝的(如果你的brew太慢,可以換成國內的源試一下)。安裝后用brew services start grafana啟動即可。啟動后,即可通過http://127.0.0.1:3000/來訪問了(默認賬號密碼是admin/admin)。進來之后應該看到這個頁面:?

更詳細的可參考:?https://blog.csdn.net/hfut_wowo/article/details/78536022


5. 安裝 DataSource?Plugin

sudo grafana-cli plugins install vertamedia-clickhouse-datasource

重啟 Grafana 使其生效

至此,Prometheus + Clickhouse + Grafana 架構安裝已全部完成

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容