部署 DashboardGraph
安装部署 Dashboard 涉及 5 种服务,本文将详细介绍如何通过 tar 包安装部署。下载和编译 Nebula Dashboard 的最新源码,请参见 Graph 页面的说明。
前提条件Graph
在部署 Dashboard 之前,用户需要确认以下信息:
- NebulaGraph 服务已经部署并启动。详细信息参考 Graph。
-
确保以下端口未被使用:
- 9200
- 9100
- 9090
- 8090
- 7003
- 使用的 Linux 发行版为 CentOS ,安装有版本为 v10.12.0 以上的 Node.js,安装有版本为 1.13 及以上的 Go。
下载 DashboardGraph
根据需要下载 tar 包,建议选择最新版本。
| Dashboard 安装包 | NebulaGraph 版本 |
|---|---|
| Graph | 2.5.0 |
目录结构说明Graph
执行命令tar -xvf nebula-graph-dashboard-1.0.2.x86_64.tar.gz解压缩,目录nebula-graph-dashboard内一共有 5 个子目录,说明如下。
| 目录名称 | 说明 | 端口号 |
|---|---|---|
| node-exporter | 收集集群中机器的资源信息,包括 CPU、内存、负载、磁盘和流量。 | 9100 |
| nebula-stats-exporter | 收集集群的性能指标,包括服务 IP 地址、版本和监控指标(例如查询数量、查询延迟、心跳延迟等)。 | 9200 |
| prometheus | 存储监控数据的时间序列数据库。 | 9090 |
| nebula-http-gateway | 为集群服务提供 HTTP 接口,执行 nGQL 语句与 NebulaGraph 数据库进行交互。 | 8090 |
| nebula-graph-dashboard | 提供 Dashboard 服务。该目录名称与根目录相同,请注意区分,后文所述nebula-graph-dashboard是指子目录。 |
7003 |
5 个目录需要按照部署需要,复制到各个机器上,详情请参见下文。
操作步骤Graph
部署node-exporter服务Graph
Note
集群中的每个机器都需要部署node-exporter服务。
在目录node-exporter内执行如下命令启动服务:
$ nohup ./node-exporter --web.listen-address=":9100" &
服务启动后,可以在浏览器中输入<IP>:9100检查服务是否正常启动。
部署nebula-stats-exporter服务Graph
Note
只需要在nebula-graph-dashboard服务所在机器部署nebula-stats-exporter服务。
-
在目录
nebula-stats-exporter内修改文件config.yaml,配置所有服务的 HTTP 端口,示例如下:version: v0.0.4 clusters: - name: nebula instances: - name: metad0 endpointIP: 192.168.8.157 endpointPort: 19559 componentType: metad - name: metad1 endpointIP: 192.168.8.155 endpointPort: 19559 componentType: metad - name: metad2 endpointIP: 192.168.8.154 endpointPort: 19559 componentType: metad - name: graphd0 endpointIP: 192.168.8.157 endpointPort: 19669 componentType: graphd - name: graphd1 endpointIP: 192.168.8.155 endpointPort: 19669 componentType: graphd - name: graphd2 endpointIP: 192.168.8.154 endpointPort: 19669 componentType: graphd - name: storaged0 endpointIP: 192.168.8.157 endpointPort: 19779 componentType: storaged - name: storaged1 endpointIP: 192.168.8.155 endpointPort: 19779 componentType: storaged - name: storaged2 endpointIP: 192.168.8.154 endpointPort: 19779 componentType: storaged -
执行如下命令启动服务:
$ nohup ./nebula-stats-exporter --listen-address=":9200" --bare-metal --bare-metal-config=./config.yaml &
服务启动后,可以在浏览器中输入<IP>:9200检查服务是否正常启动。
部署prometheus服务Graph
Note
只需要在nebula-graph-dashboard服务所在机器部署prometheus服务。
-
在目录
prometheus内修改文件prometheus.yaml,配置node-exporter服务和nebula-stats-exporter服务的 IP 地址和端口,示例如下:global: scrape_interval: 5s evaluation_interval: 5s scrape_configs: - job_name: 'nebula-stats-exporter' static_configs: - targets: [ '192.168.xx.100:9200', # nebula-stats-exporter 服务的 IP 地址和端口。 ] - job_name: 'node-exporter' static_configs: - targets: [ '192.168.xx.100:9100', # node-exporter 服务的 IP 地址和端口。 '192.168.xx.101:9100' ]- scrape_interval:收集监控数据的间隔时间。默认为 1 分钟。
- evaluation_interval:告警规则扫描时间间隔。默认为 1 分钟。
-
执行如下命令启动服务:
$ nohup ./prometheus --config.file=./prometheus.yaml &
服务启动后,可以在浏览器中输入<IP>:9090检查服务是否正常启动。
部署nebula-http-gateway服务Graph
Note
只需要在nebula-graph-dashboard服务所在机器部署nebula-http-gateway服务。
在目录nebula-http-gateway内执行如下命令启动服务:
$ nohup ./nebula-httpd &
服务启动后,可以在浏览器中输入<IP>:8090检查服务是否正常启动。
部署nebula-graph-dashboard服务Graph
-
在目录
nebula-graph-dashboard/static/内修改文件custom.json,配置 Graph 服务的 IP 地址和端口,示例如下:{ "connection": { "ip": "192.168.xx.4", "port": 9669 }, "alias": { "ip:port": "instance1" }, "chartBaseLine": { } } ... -
在目录
nebula-graph-dashboard内执行如下命令启动服务:$ npm run start
服务启动后,可以在浏览器中输入<IP>:7003检查服务是否正常启动。
停止 DashboardGraph
如果需要停止 Dashboard,可以使用kill <pid>的方式停止,示例如下:
$ kill $(lsof -t -i :9100) # 停止 node-exporter 服务
$ kill $(lsof -t -i :9200) # 停止 nebula-stats-exporter 服务
$ kill $(lsof -t -i :9090) # 停止 prometheus 服务
$ kill $(lsof -t -i :8090) # 停止 nebula-http-gateway 服务
$ cd nebula-graph-dashboard
$ npm run stop # 停止 nebula-graph-dashboard 服务