部署 Dashboard 社区版
本文将介绍如何通过 TAR 包安装部署 NebulaGraph Dashboard。
下载和编译 Dashboard 的最新源码,参见 GitHub NebulaGraph dashboard 页面的说明。
前提条件
在部署 Dashboard 之前,用户需要确认以下信息:
-
悦数图数据库 服务已经部署并启动。详细信息参考 悦数图数据库 安装部署。
-
确保以下端口未被使用:
-
9200
-
9100
-
9090
-
8090
-
7003
-
-
待监控的机器上已经安装 node-exporter。安装方法请参见 Prometheus 官方文档。
操作步骤
-
下载 TAR 包 nebula-dashboard-3.4.0.x86_64.tar.gz。
-
执行命令
tar -xvf nebula-dashboard-3.4.0.x86_64.tar.gz解压缩。 -
进入解压缩的
nebula-dashboard文件夹,并修改配置文件config.yaml。
配置文件内主要包含 4 种依赖服务的配置和集群的配置。依赖服务的说明如下。
| 服务名称 | 默认端口号 | 说明 |
|---|---|---|
| nebula-http-gateway | 8090 | 为集群服务提供 HTTP 接口,执行 nGQL 语句与 悦数图数据库 进行交互。 |
| nebula-stats-exporter | 9200 | 收集集群的性能指标,包括服务 IP 地址、版本和监控指标(例如查询数量、查询延迟、心跳延迟 等)。 |
| node-exporter | 9100 | 收集集群中机器的资源信息,包括 CPU、内存、负载、磁盘和流量。 |
| prometheus | 9090 | 存储监控数据的时间序列数据库。 |
配置文件说明如下。
port: 7003 # Web 服务端口。
gateway:
ip: hostIP # 部署 Dashboard 的机器 IP。
port: 8090
https: false # 是否为 HTTPS 端口。
runmode: dev # 程序运行模式,包括 dev、test、prod。一般用于区分不同运行环境。
stats-exporter:
ip: hostIP # 部署 Dashboard 的机器 IP。
nebulaPort: 9200
https: false # 是否为 HTTPS 端口。
node-exporter:
- ip: nebulaHostIP_1 # 部署 <ProductName /> 的机器 IP。
port: 9100
https: false # 是否为 HTTPS 端口。
# - ip: nebulaHostIP_2
# port: 9100
# https: false
prometheus:
ip: hostIP # 部署 Dashboard 的机器 IP。
prometheusPort: 9090
https: false # 是否为 HTTPS 端口。
scrape_interval: 5s # 收集监控数据的间隔时间。默认为 1 分钟。
evaluation_interval: 5s # 告警规则扫描时间间隔。默认为 1 分钟。
# 集群节点信息
nebula-cluster:
name: 'default' # 集群名称
metad:
- name: metad0
endpointIP: nebulaMetadIP # 部署 Meta 服务的机器 IP。
port: 9559
endpointPort: 19559
# - name: metad1
# endpointIP: nebulaMetadIP
# port: 9559
# endpointPort: 19559
graphd:
- name: graphd0
endpointIP: GraphdIP # 部署 Graph 服务的机器 IP。
port: 9669
endpointPort: 19669
# - name: graphd1
# endpointIP: GraphdIP
# port: 9669
# endpointPort: 19669
storaged:
- name: storaged0
endpointIP: StoragedIP # 部署 Storage 服务的机器 IP。
port: 9779
endpointPort: 19779
# - name: storaged1
# endpointIP: StoragedIP
# port: 9779
# endpointPort: 19779
- 执行
./dashboard.service start all一键启动服务。
容器部署
如果使用容器部署 Dashboard,同样是修改配置文件config.yaml,修改完成后,执行docker-compose up -d即可启动容器。
备注
如果修改了config.yaml内的端口号,docker-compose.yaml里的端口号也需要保持一致。
执行docker-compose stop命令停止容器部署的 Dashboard。
管理 Dashboard 服务
Dashboard 使用脚本dashboard.service管理服务,包括启动、重启、停止和查看状态。
sudo <dashboard_path>/dashboard.service
[-v] [-h]
<start|restart|stop|status> <prometheus|webserver|exporter|gateway|all>
| 参数 | 说明 |
|---|---|
dashboard_path | Dashboard 安装路径。 |
-v | 显示详细调试信息。 |
-h | 显示帮助信息。 |
start | 启动服务。 |
restart | 重启服务。 |
stop | 停止服务。 |
status | 查看服务状态。 |
prometheus | 管理 prometheus 服务。 |
webserver | 管理 webserver 服务。 |
exporter | 管理 exporter 服务。 |
gateway | 管理 gateway 服务。 |
all | 管理所有服务。 |
备注
查看 Dashboard 版本可以使用命令./dashboard.service -version。