部署DashboardGraph
安装部署Dashboard涉及5种服务,本文将详细介绍如何安装部署。
NebulaGraph版本Graph
Dashboard版本和NebulaGraph的版本对应关系如下。
| Dashboard版本 | NebulaGraph版本 |
|---|---|
| 1.0.1 | 2.x |
端口说明Graph
部署Dashboard需要占用如下端口:
- 9200
- 9100
- 9090
- 8090
- 7003
下载DashboardGraph
根据需要下载 tar 包,建议选择最新版本。
| Dashboard 安装包 | NebulaGraph版本 |
|---|---|
| Graph | 2.5.0 |
目录结构说明Graph
执行命令tar -xvf nebula-graph-dashboard-1.0.1.x86_64.tar.gz解压缩,目录nebula-graph-dashboard内一共有5个子目录,说明如下。
| 目录名称 | 说明 |
|---|---|
| node-exporter | 收集集群中机器的资源信息,包括CPU、内存、负载、磁盘和流量。 |
| nebula-stats-exporter | 收集集群的性能指标,包括服务IP地址、版本和监控指标(例如查询数量、查询延迟、心跳延迟等)。 |
| prometheus | 存储监控数据的时间序列数据库。 |
| nebula-http-gateway | 为集群服务提供HTTP接口,执行nGQL语句与NebulaGraph数据库进行交互。 |
| nebula-graph-dashboard | 提供Dashboard服务。该目录名称与根目录相同,请注意区分,后文所述nebula-graph-dashboard是指子目录。 |
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-exporter' static_configs: - targets: [ '192.168.xx.100:9200', # nebula-stats-exporter服务的IP地址和端口。 '192.168.xx.101:9200' ] - job_name: 'node-exporter' static_configs: - targets: [ '192.168.xx.101:9100' # node-exporter服务的IP地址和端口。 ]- 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服务