部署Dashboard

安装部署Dashboard涉及5种服务,本文将详细介绍如何通过 tar 包安装部署。下载和编译Nebula Dashboard的最新源码,请参见GitHub nebula dashboard页面的说明。

Nebula Graph版本

Dashboard版本和Nebula Graph的版本对应关系如下。

Dashboard版本Nebula Graph版本
1.0.22.x

前提条件

在部署 Dashboard 之前,用户需要确认以下信息:

  • Nebula Graph 服务已经部署并启动。详细信息参考Nebula Graph安装部署

  • 确保以下端口未被使用:

    • 9200

    • 9100

    • 9090

    • 8090

    • 7003

  • 使用的 Linux 发行版为 CentOS ,安装有版本为 v10.12.0 以上的 Node.js,安装有版本为1.13及以上的Go。

下载Dashboard

根据需要下载 tar 包,建议选择最新版本。

Dashboard 安装包Nebula Graph版本
nebula-graph-dashboard-1.0.2.x86_64.tar.gz2.5.0

目录结构说明

执行命令tar -xvf nebula-graph-dashboard-1.0.2.x86_64.tar.gz解压缩,目录nebula-graph-dashboard内一共有5个子目录,说明如下。

目录名称说明
node-exporter收集集群中机器的资源信息,包括CPU、内存、负载、磁盘和流量。
nebula-stats-exporter收集集群的性能指标,包括服务IP地址、版本和监控指标(例如查询数量、查询延迟、心跳延迟等)。
prometheus存储监控数据的时间序列数据库。
nebula-http-gateway为集群服务提供HTTP接口,执行nGQL语句与Nebula Graph数据库进行交互。
nebula-graph-dashboard提供Dashboard服务。该目录名称与根目录相同,请注意区分,后文所述nebula-graph-dashboard是指子目录。

5个目录需要按照部署需要,复制到各个机器上,详情请参见下文。

操作步骤

部署node-exporter服务

Note

集群中的每个机器都需要部署node-exporter服务。

在目录node-exporter内执行如下命令启动服务:

  1. $ nohup ./node-exporter --web.listen-address=":9100" &

服务启动后,可以在浏览器中输入<IP>:9100检查服务是否正常启动。

部署nebula-stats-exporter服务

Note

只需要在nebula-graph-dashboard服务所在机器部署nebula-stats-exporter服务。

  1. 在目录nebula-stats-exporter内修改文件config.yaml,配置所有服务的HTTP端口,示例如下:

    1. version: v0.0.4
    2. clusters:
    3. - name: nebula
    4. instances:
    5. - name: metad0
    6. endpointIP: 192.168.8.157
    7. endpointPort: 19559
    8. componentType: metad
    9. - name: metad1
    10. endpointIP: 192.168.8.155
    11. endpointPort: 19559
    12. componentType: metad
    13. - name: metad2
    14. endpointIP: 192.168.8.154
    15. endpointPort: 19559
    16. componentType: metad
    17. - name: graphd0
    18. endpointIP: 192.168.8.157
    19. endpointPort: 19669
    20. componentType: graphd
    21. - name: graphd1
    22. endpointIP: 192.168.8.155
    23. endpointPort: 19669
    24. componentType: graphd
    25. - name: graphd2
    26. endpointIP: 192.168.8.154
    27. endpointPort: 19669
    28. componentType: graphd
    29. - name: storaged0
    30. endpointIP: 192.168.8.157
    31. endpointPort: 19779
    32. componentType: storaged
    33. - name: storaged1
    34. endpointIP: 192.168.8.155
    35. endpointPort: 19779
    36. componentType: storaged
    37. - name: storaged2
    38. endpointIP: 192.168.8.154
    39. endpointPort: 19779
    40. componentType: storaged
  2. 执行如下命令启动服务:

    1. $ nohup ./nebula-stats-exporter --listen-address=":9200" --bare-metal --bare-metal-config=./config.yaml &

服务启动后,可以在浏览器中输入<IP>:9200检查服务是否正常启动。

部署prometheus服务

Note

只需要在nebula-graph-dashboard服务所在机器部署prometheus服务。

  1. 在目录prometheus内修改文件prometheus.yaml,配置node-exporter服务和nebula-stats-exporter服务的IP地址和端口,示例如下:

    1. global:
    2. scrape_interval: 5s
    3. evaluation_interval: 5s
    4. scrape_configs:
    5. - job_name: 'nebula-exporter'
    6. static_configs:
    7. - targets: [
    8. '192.168.xx.100:9200', # nebula-stats-exporter服务的IP地址和端口。
    9. '192.168.xx.101:9200'
    10. ]
    11. - job_name: 'node-exporter'
    12. static_configs:
    13. - targets: [
    14. '192.168.xx.101:9100' # node-exporter服务的IP地址和端口。
    15. ]
    • scrape_interval:收集监控数据的间隔时间。默认为1分钟。

    • evaluation_interval:告警规则扫描时间间隔。默认为1分钟。

  2. 执行如下命令启动服务:

    1. $ nohup ./prometheus --config.file=./prometheus.yaml &

服务启动后,可以在浏览器中输入<IP>:9090检查服务是否正常启动。

部署nebula-http-gateway服务

Note

只需要在nebula-graph-dashboard服务所在机器部署nebula-http-gateway服务。

在目录nebula-http-gateway内执行如下命令启动服务:

  1. $ nohup ./nebula-httpd &

服务启动后,可以在浏览器中输入<IP>:8090检查服务是否正常启动。

部署nebula-graph-dashboard服务

  1. 在目录nebula-graph-dashboard/static/内修改文件custom.json,配置Graph服务的IP地址和端口,示例如下:

    1. {
    2. "connection": {
    3. "ip": "192.168.xx.4",
    4. "port": 9669
    5. },
    6. "alias": {
    7. "ip:port": "instance1"
    8. },
    9. "chartBaseLine": {
    10. }
    11. }
    12. ...
  2. 在目录nebula-graph-dashboard内执行如下命令启动服务:

    1. $ npm run start

服务启动后,可以在浏览器中输入<IP>:7003检查服务是否正常启动。

停止Dashboard

如果需要停止Dashboard,可以使用kill <pid>的方式停止,示例如下:

  1. $ kill $(lsof -t -i :9100) # 停止node-exporter服务
  2. $ kill $(lsof -t -i :9200) # 停止nebula-stats-exporter服务
  3. $ kill $(lsof -t -i :9090) # 停止prometheus服务
  4. $ kill $(lsof -t -i :8090) # 停止nebula-http-gateway服务
  5. $ cd nebula-graph-dashboard
  6. $ npm run stop # 停止nebula-graph-dashboard服务

最后更新: September 27, 2021