Neo4j 企業(yè)版因果集群監(jiān)控 —— Prometheus

經(jīng)常有朋友問 Neo4j 部署完成后,怎么來實時監(jiān)控服務(wù)運(yùn)行狀態(tài)呢?本文將簡單介紹 Prometheus 的部署及使用,為朋友們解惑。

Prometheus【普羅米修斯】,是一項 SoundCloud 開源的監(jiān)控和報警解決方案,能夠?qū)崿F(xiàn)與當(dāng)下最流行的 Kubernetes 無縫連接,使得 Prometheus 逐漸成為主流監(jiān)控方案。


從 Neo4j Enterprise 3.4 版本,可以使用開源工具 Prometheus 來對 Neo4j 運(yùn)行狀況進(jìn)行監(jiān)控。本文詳細(xì)介紹了 Prometheus 的基本實現(xiàn),以演示 Prometheus v2.17.1 和 Neo4j 之間的連接。
我的環(huán)境是:Mac Catalina 10.15.3,Neo4j Enterprise 3.5.14。

1、下載 prometheus-2.17.1.linux-amd64.tar.gz (57.4M):

2、修改neo4j.conf文件,配置以下參數(shù),并啟動 Neo4j :

# Enable the Prometheus endpoint. Default is 'false'. 
metrics.prometheus.enabled=true 
# The IP and port the endpoint will bind to in the format <hostname or IP address>:<port number>. 
# The default is localhost:2004. 
metrics.prometheus.endpoint=localhost:2004

啟動 Neo4j 后,可看到如下圖所示的輸出信息:


3、解壓 prometheus-2.17.1.linux-amd64.tar.gz

修改 prometheus 的prometheus.yml文件,配置如下:

# A scrape configuration containing exactly one endpoint to scrape: 
# Here it's Prometheus itself. 
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config. 
  - job_name: 'Neo4j-prometheus' 
      # metrics_path: /metrics 
      # scheme defaults to 'http'. 
      static_configs: - targets: ['localhost:2004']

注意:上面的配置是假設(shè) Prometheus 與 Neo4j 部署在同一服務(wù)器上, 如果部署在不同的服務(wù)器,只需將 prometheus.yml 文件中對 “l(fā)ocalhost” 的配置替換為 Neo4j 實例的 IP 地址。

4、啟動 prometheus:

prometheus --config.file=prometheus.yml

5、 http://<Prometheus Server IP>:9090 啟動 Prometheus 瀏覽器:

打開 localhost:9090 就可以看到 prometheus 的監(jiān)控頁面。

單擊菜單Status→ Targets, 如下圖所示:

點(diǎn)擊菜單Graph,可以選擇一個圖表來監(jiān)控 Neo4j 運(yùn)行狀態(tài)。例如,在下圖中,該圖表示已啟動的事務(wù)數(shù)(neo4j_transaction_started):

更多監(jiān)控資料,請查看 Neo4j 官網(wǎng)文檔。

轉(zhuǎn)載請注明出處,謝謝。

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

推薦閱讀更多精彩內(nèi)容