美文网首页图数据库与Neo4j
Neo4j 企业版因果集群监控 —— Prometheus

Neo4j 企业版因果集群监控 —— Prometheus

作者: 数据大鱼 | 来源:发表于2020-03-31 12:10 被阅读0次

    经常有朋友问 Neo4j 部署完成后,怎么来实时监控服务运行状态呢?本文将简单介绍 Prometheus 的部署及使用,为朋友们解惑。

    Prometheus【普罗米修斯】,是一项 SoundCloud 开源的监控和报警解决方案,能够实现与当下最流行的 Kubernetes 无缝连接,使得 Prometheus 逐渐成为主流监控方案。


    从 Neo4j Enterprise 3.4 版本,可以使用开源工具 Prometheus 来对 Neo4j 运行状况进行监控。本文详细介绍了 Prometheus 的基本实现,以演示 Prometheus v2.17.1 和 Neo4j 之间的连接。
    我的环境是:Mac Catalina 10.15.3,Neo4j Enterprise 3.5.14。

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

    2、修改neo4j.conf文件,配置以下参数,并启动 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']
    

    注意:上面的配置是假设 Prometheus 与 Neo4j 部署在同一服务器上, 如果部署在不同的服务器,只需将 prometheus.yml 文件中对 “localhost” 的配置替换为 Neo4j 实例的 IP 地址。

    4、启动 prometheus:

    prometheus --config.file=prometheus.yml
    

    5、 http://<Prometheus Server IP>:9090 启动 Prometheus 浏览器:

    打开 localhost:9090 就可以看到 prometheus 的监控页面。

    单击菜单Status→ Targets, 如下图所示:

    点击菜单Graph,可以选择一个图表来监控 Neo4j 运行状态。例如,在下图中,该图表示已启动的事务数(neo4j_transaction_started):

    更多监控资料,请查看 Neo4j 官网文档。

    转载请注明出处,谢谢。

    相关文章

      网友评论

        本文标题:Neo4j 企业版因果集群监控 —— Prometheus

        本文链接:https://www.haomeiwen.com/subject/gtkwuhtx.html