本篇內容主要講解“使用Grafana監控Doris的方法”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學習“使用Grafana監控Doris的方法”吧!
Prometheus 是一個開放性的監控解決方案,用戶可以非常方便的安裝和使用 Prometheus 并且能夠非常方便的對其進行擴展。為了能夠更加直觀的了解 Prometheus Server,接下來我們將在本地部署并運行一個 Prometheus Server實例,通過 Node Exporter 采集當前主機的系統資源使用情況。 并通過 Grafana 創建一個簡單的可視化儀表盤。
Prometheus 基于 Golang 編寫,編譯后的軟件包,不依賴于任何的第三方依賴。用戶只需要下載對應平臺的二進制包,解壓并且添加基本的配置即可正常啟動 Prometheus Server。具體安裝過程可以參考如下內容。
本次我們選擇在 CentOS7 上安裝 prometheus ,其他系統安裝過程類似,這里不再一一贅述
為了安全,我們這里不用 root 用戶啟動相關服務,而是用我們自建的 prometheus 用戶啟動服務,首先需要創建一個用戶:
? groupadd prometheus ? useradd -g prometheus -M -s /sbin/nologin prometheus
我們需要從 prometheus下載頁 下載我們需要安裝的版本,這里我們選擇則安裝的 prometheus 版本是 v2.7.1 的最新版本。
? wget https://github.com/prometheus/prometheus/releases/download/v2.7.1/prometheus-2.7.1.linux-amd64.tar.gz
解壓并安裝 prometheus 服務:
? tar xf prometheus-2.22.2.linux-amd64.tar -C /srv/ ? cd /soft/ ? mv prometheus-2.22.2.linux-amd64/ prometheus ? mkdir -pv /soft/prometheus/data ? chown -R prometheus.prometheus /soft/prometheus
創建 prometheus 系統服務啟動文件 /usr/lib/systemd/system/prometheus.service
:
[Unit] Description=Prometheus Server Documentation=https://prometheus.io/docs/introduction/overview/ After=network-online.target [Service] User=prometheus Restart=on-failure ExecStart=/soft/prometheus/prometheus \ --config.file=/soft/prometheus/prometheus.yml \ --storage.tsdb.path=/srv/prometheus/data ExecReload=/bin/kill -HUP $MAINPID [Install] WantedBy=multi-user.target
修改 prometheus 配置文件 /srv/prometheus/prometheus.yml
:
? grep -v '^#' /srv/prometheus/prometheus.yml global: scrape_interval: 15s evaluation_interval: 15s alerting: alertmanagers: - static_configs: - targets: ["localhost:9093"] rule_files: #- "alert.rules" scrape_configs: # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config. - job_name: 'DORIS_CLUSTER' # 每一個 Doris 集群,我們稱為一個 job。這里可以給 job 取一個名字,作為 Doris 集群在監控系統中的名字。 metrics_path: '/metrics' # 這里指定獲取監控項的 restful api。配合下面的 targets 中的 host:port,Prometheus 最終會通過 host:port/metrics_path 來采集監控項。 static_configs: # 這里開始分別配置 FE 和 BE 的目標地址。所有的 FE 和 BE 都分別寫入各自的 group 中。 - targets: ['doris01:8030'] labels: group: fe # 這里配置了 fe 的 group,該 group 中包含了 3 個 Frontends - targets: ['doris02:8040', 'doris03:8040', 'doris04:8040', 'doris05:8040', 'doris06:8040', 'doris07:8040'] labels: group: be # 這里配置了 be 的 group,該 group 中包含了 3 個 Backends - job_name: 'prometheus' # metrics_path defaults to '/metrics' # scheme defaults to 'http'. static_configs: - targets: ['localhost:9090']
啟動服務:
? systemctl daemon-reload ? systemctl start prometheus.service ? systemctl enable prometheus.service ? systemctl status prometheus.service
Prometheus 服務支持熱加載配置:
? systemctl reload prometheus.service
Prometheus 服務啟動完成后,可以通過http://localhost:9090訪問 Prometheus 的 UI 界面。
Grafana 我們主要用它來展示 Prometheus 的監控指標的,這樣可以直觀查看各節點或者服務的狀態,本次安裝 grafana 我們直接用 yum 安裝即可,具體操作也可以參考官方文檔
寫在rpm安裝包
wget https://dl.grafana.com/oss/release/grafana-7.3.3-1.x86_64.rpm
設置grafana服務開機自啟,并啟動服務
# systemctl daemon-reload # systemctl enable grafana-server.service # systemctl start grafana-server.service
瀏覽器訪問http://192.168.56.200:3000(IP:3000端口),即可打開grafana頁面,默認用戶名密碼都是admin,初次登錄會要求修改默認的登錄密碼
然后定義數據源,定義Dashboard或者導入Dashboard json文件
到此,相信大家對“使用Grafana監控Doris的方法”有了更深的了解,不妨來實際操作一番吧!這里是億速云網站,更多相關內容可以進入相關頻道進行查詢,關注我們,繼續學習!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。