安装部署
轻松上手:通过 RPM 包快速部署 NebulaGraph
导读:最近 NebulaGraph 社区来了很多新朋友,星云仔发现部分小伙伴还未部署 NebulaGraph,分享 NebulaGraph 论坛上超详细的一篇部署教程给大家,希望大家尽情探索图数据库的新世界~
作者 @ShunWah,NebulaGraph NGCP, 在运维管理领域,有多年深厚的专业积累,兼具坚实的理论基础与广泛的实践经验。本文结合 NebulaGraph 官方文档和部署经验而作,介绍如何使用 RPM 包在 CentOS 系统上安装 NebulaGraph,并简要介绍了其配置和使用方法。
一、环境准备
- 操作系统要求
确保你的服务器运行的是支持 RPM 包管理系统的 Linux 发行版,当前仅支持在 Linux 系统下安装 NebulaGraph,且仅支持 CentOS 7.x、CentOS 8.x、Ubuntu 16.04、Ubuntu 18.04、Ubuntu 20.04 操作系统。推荐使用 64 位操作系统以获得最佳性能。
如果你使用的是国产化的 Linux 操作系统,请安装企业版 NebulaGraph.
[root@instance2 ~]#
[root@instance2 ~]# cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)
[root@instance2 ~]#
- 硬件要求
CPU:至少 2 核心,建议 4 核心或以上。
内存:至少 8GB RAM,根据数据量大小适当增加。
磁盘空间:确保有足够的磁盘空间用于存储数据和日志文件。
[root@instance2 ~]# cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
8 Intel(R) Xeon(R) Gold 5118 CPU @ 2.30GHz
[root@instance2 ~]# free -h
total used free shared buff/cache available
Mem: 31G 14G 6.3G 676K 10G 16G
Swap: 0B 0B 0B
[root@instance2 ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/centos_caip122-root ext4 42G 27G 13G 68% /
devtmpfs devtmpfs 16G 0 16G 0% /dev
tmpfs tmpfs 16G 0 16G 0% /dev/shm
tmpfs tmpfs 16G 676K 16G 1% /run
tmpfs tmpfs 16G 0 16G 0% /sys/fs/cgroup
/dev/sda2 ext4 190M 93M 83M 53% /boot
/dev/sdc1 xfs 100G 103M 100G 1% /redo
/dev/sdb1 xfs 100G 41G 60G 41% /data
- 访问官方文档
访问 NebulaGraph 的官方文档-使用 RPM/DEB 包安装。
https://docs.nebula-graph.com.cn/3.8.0/4.deployment-and-installation/2.compile-and-install-nebula-graph/2.install-nebula-graph-by-rpm-or-deb/
- 软件依赖
在安装 NebulaGraph 之前,请确认已安装以下软件包:
[root@instance2 ~]# yum install -y epel-release
Loaded plugins: fastestmirror
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#7 - "Failed to connect to 2600:1f16:c1:5e01:4180:6610:5482:c1c0: Network is unreachable"
base | 3.6 kB 00:00:00
epel/x86_64/metalink | 4.7 kB 00:00:00
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=extras&infra=stock error was
14: curl#7 - "Failed to connect to 2600:1f16:c1:5e01:4180:6610:5482:c1c0: Network is unreachable"
extras | 2.9 kB 00:00:00
mysql-connectors-community | 2.6 kB 00:00:00
mysql-tools-community | 2.6 kB 00:00:00
mysql57-community | 2.6 kB 00:00:00
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=updates&infra=stock error was
14: curl#7 - "Failed to connect to 2600:1f16:c1:5e01:4180:6610:5482:c1c0: Network is unreachable"
updates | 2.9 kB 00:00:00
Determining fastest mirrors
* base: mirrors.bupt.edu.cn
* epel: repo.jing.rocks
* extras: mirrors.bupt.edu.cn
* updates: mirrors.bupt.edu.cn
Package epel-release-7-14.noarch already installed and latest version
Nothing to do
[root@instance2 ~]#
[root@instance2 ~]# yum install -y wget curl tar gcc make cmake openssl-devel python3-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.bupt.edu.cn
* epel: repo.jing.rocks
* extras: mirrors.bupt.edu.cn
* updates: mirrors.bupt.edu.cn
Package wget-1.14-18.el7_6.1.x86_64 already installed and latest version
Package gcc-4.8.5-44.el7.x86_64 already installed and latest version
Package 1:openssl-devel-1.0.2k-26.el7_9.x86_64 already installed and latest version
Resolving Dependencies
- 下载安装包
5.1 阿里云 OSS 下载 release 版本
URL 格式如下:
//Centos 7
https://oss-cdn.nebula-graph.com.cn/package/<release_version>/nebula-graph-<release_version>.el7.x86_64.rpm
根据所需版本选择对应的 RPM 包下载链接。
例如,如需下载 3.8.0 版本的 NebulaGraph,CentOS 7 用户应选择 nebula-graph-3.8.0.el7.x86_64.rpm.
5.2 使用 wget 命令下载 RPM 包
使用 wget 命令下载 RPM 包
wget https://oss-cdn.nebula-graph.com.cn/package/3.8.0/nebula-graph-3.8.0.ubuntu1804.amd64.deb
wget https://oss-cdn.nebula-graph.com.cn/package/3.8.0/nebula-graph-3.8.0.ubuntu1804.amd64.deb.sha256sum.txt
[root@instance2 soft]# wget https://oss-cdn.nebula-graph.com.cn/package/3.8.0/nebula-graph-3.8.0.el7.x86_64.rpm
--2025-01-07 14:07:36-- https://oss-cdn.nebula-graph.com.cn/package/3.8.0/nebula-graph-3.8.0.el7.x86_64.rpm
Resolving oss-cdn.nebula-graph.com.cn (oss-cdn.nebula-graph.com.cn)... 220.181.166.204
Connecting to oss-cdn.nebula-graph.com.cn (oss-cdn.nebula-graph.com.cn)|220.181.166.204|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 64791652 (62M) [application/x-redhat-package-manager]
Saving to: ‘nebula-graph-3.8.0.el7.x86_64.rpm’
100%[======================================================================================>] 64,791,652 7.54MB/s in 10s
2025-01-07 14:07:46 (6.12 MB/s) - ‘nebula-graph-3.8.0.el7.x86_64.rpm’ saved [64791652/64791652]
[root@instance2 soft]# wget https://oss-cdn.nebula-graph.com.cn/package/3.8.0/nebula-graph-3.8.0.el7.x86_64.rpm.sha256sum.txt
--2025-01-07 14:08:06-- https://oss-cdn.nebula-graph.com.cn/package/3.8.0/nebula-graph-3.8.0.el7.x86_64.rpm.sha256sum.txt
Resolving oss-cdn.nebula-graph.com.cn (oss-cdn.nebula-graph.com.cn)... 220.181.166.204
Connecting to oss-cdn.nebula-graph.com.cn (oss-cdn.nebula-graph.com.cn)|220.181.166.204|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 125 [text/plain]
Saving to: ‘nebula-graph-3.8.0.el7.x86_64.rpm.sha256sum.txt’
100%[======================================================================================>] 125 --.-K/s in 0s
2025-01-07 14:08:06 (923 KB/s) - ‘nebula-graph-3.8.0.el7.x86_64.rpm.sha256sum.txt’ saved [125/125]
[root@instance2 soft]#
二、安装 NebulaGraph
- 创建指定安装目录
[root@instance2 opt]# mkdir -p app/nebula-graph
[root@instance2 opt]# cd app/nebula-graph/
[root@instance2 nebula-graph]# pwd
/opt/app/nebula-graph
[root@instance2 nebula-graph]#
- 安装 RPM 包
使用 rpm 命令安装下载的 RPM 包。例如,安装到 /opt/app/nebula-graph 目录(或默认路径):
[root@instance2 soft]# ls
nebula-graph-3.8.0.el7.x86_64.rpm nebula-graph-3.8.0.el7.x86_64.rpm.sha256sum.txt openssh-rpms
[root@instance2 soft]# rpm -ivh --prefix=/opt/app/nebula-graph nebula-graph-3.8.0.el7.x86_64.rpm
Preparing... ################################# [100%]
Updating / installing...
1:nebula-graph-3.8.0-1 ################################# [100%]
[root@instance2 soft]#
–prefix 为可选项,用于指定安装路径。如不设置,系统会将 NebulaGraph 安装到默认路径/usr/local/nebula/。
例如,要在默认路径下安装 3.8.0 版本的 RPM 包,运行如下命令:
sudo rpm -ivh nebula-graph-3.8.0.el7.x86_64.rpm
- 配置 NebulaGraph
安装完成后,默认情况下 NebulaGraph 的配置文件位于指定 /opt/app/nebula-graph 安装目录下的 /etc/nebula/ 目录。你可以根据实际需求编辑这些配置文件来调整服务参数。例如,修改监听端口、设置集群模式等。
3.1 编辑配置文件
[root@instance2 opt]# cd app/nebula-graph/
[root@instance2 nebula-graph]# ls
bin etc scripts share
[root@instance2 nebula-graph]# cd etc/
[root@instance2 etc]# ls
nebula-graphd.conf nebula-metad.conf.default nebula-storaged.conf.production
nebula-graphd.conf.default nebula-metad.conf.production nebula-storaged-listener.conf.production
nebula-graphd.conf.production nebula-storaged.conf
nebula-metad.conf nebula-storaged.conf.default
[root@instance2 etc]# vim nebula-graphd.conf
三、启动 NebulaGraph 服务
- 使用脚本管理服务
使用脚本 nebula.service 管理服务,包括启动、停止、重启、中止和查看。
nebula.service 的默认路径是/usr/local/nebula/scripts,如果修改过安装路径,请使用实际路径。
语法参数说明
$ sudo /usr/local/nebula/scripts/nebula.service
[-v] [-c <config_file_path>]
<start | stop | restart | kill | status>
<metad | graphd | storaged | all>

- 查询服务状态:
使用以下命令查询 NebulaGraph 服务的状态:
[root@instance2 etc]# /opt/app/nebula-graph/scripts/nebula.service status all
[INFO] nebula-metad(7458486): Exited
[INFO] nebula-graphd(7458486): Exited
[INFO] nebula-storaged(7458486): Exited
[root@instance2 etc]#
查询状态显示目前服务并没有启动。
或者,如果安装在默认路径下:
sudo /usr/local/nebula/scripts/nebula.service status all
- 启动 NebulaGraph 服务:
使用以下命令启动所有 NebulaGraph 进程:
[root@instance2 etc]# /opt/app/nebula-graph/scripts/nebula.service start all
[INFO] Starting nebula-metad...
[INFO] Done
[INFO] Starting nebula-graphd...
[INFO] Done
[INFO] Starting nebula-storaged...
[INFO] Done
[root@instance2 etc]#
- 停止 NebulaGraph 服务
请勿使用kill -9 命令强制终止进程,否则可能较小概率出现数据丢失。
执行如下命令停止 NebulaGraph 服务:
[root@instance2 nebula-graph]# /opt/app/nebula-graph/scripts/nebula.service stop all
[INFO] Stopping nebula-metad...
[INFO] Done
[INFO] Stopping nebula-graphd...
[INFO] Done
[INFO] Stopping nebula-storaged...
[INFO] Done
[root@instance2 nebula-graph]#
- 查看 NebulaGraph 服务
执行如下命令查看 NebulaGraph 服务状态。
$ sudo /usr/local/nebula/scripts/nebula.service status all
如果返回如下结果,表示 NebulaGraph 服务正常运行。
[INFO] nebula-metad(33fd35e): Running as 29020, Listening on 9559
[INFO] nebula-graphd(33fd35e): Running as 29095, Listening on 9669
[WARN] nebula-storaged after v3.0.0 will not start service until it is added to cluster.
[WARN] See Manage Storage hosts:ADD HOSTS in https://docs.nebula-graph.io/
[INFO] nebula-storaged(33fd35e): Running as 29147, Listening on 9779
Note
正常启动 NebulaGraph 后,nebula-storaged 进程的端口显示红色。这是因为
nebula-storaged 在启动流程中会等待 nebula-metad 添加当前 Storage 服务,当前 Storage 服务收到 Ready 信号后才会正式启动服务。
从 3.0.0 版本开始,在配置文件中添加的 Storage 节点无法直接读写,配置文件的作用仅仅是将 Storage 节点注册至 Meta 服务中。必须使用 ADD HOSTS 命令后,才能正常读写 Storage 节点。
更多信息,参见管理 Storage 主机。
https://docs.nebula-graph.com.cn/3.8.0/4.deployment-and-installation/manage-storage-host/
- 启动报错及解决办法
6.1 启动时报错 Storage hosts:服务异常
如果返回类似如下结果,表示 NebulaGraph 服务异常,可以根据异常服务信息进一步排查,或者在 NebulaGraph 社区寻求帮助。
[root@instance2 etc]# /opt/app/nebula-graph/scripts/nebula.service status all
[INFO] nebula-metad(7458486): Running as 26056, Listening on 9559
[INFO] nebula-graphd(7458486): Running as 26079, Listening on 9669
[WARN] nebula-storaged after v3.0.0 will not start service until it is added to cluster.
[WARN] See Manage Storage hosts:ADD HOSTS in https://docs.nebula-graph.io/
[INFO] nebula-storaged(7458486): Running as 26101, Listening on 9779
[root@instance2 etc]#
6.2 参考官方文档解决
查询状态 "OFFLINE" 节点失败
(root@nebula) [(none)]> SHOW HOSTS STORAGE;
+----------------+------+-----------+-----------+--------------+---------+
| Host | Port | Status | Role | Git Info Sha | Version |
+----------------+------+-----------+-----------+--------------+---------+
| "127.0.0.1" | 9779 | "OFFLINE" | "STORAGE" | "" | |
+----------------+------+-----------+-----------+--------------+---------+
Got 2 rows (time spent 1.722ms/2.445398ms)
Tue, 07 Jan 2025 15:16:46 CST
(root@nebula) [(none)]>
6.3 向集群中增加 Storage 主机
(root@nebula) [(none)]> ADD HOSTS 127.0.0.1:9779;
Execution succeeded (time spent 1.593ms/2.152096ms)
Tue, 07 Jan 2025 15:16:40 CST
(root@nebula) [(none)]>
6.4 再次检查状态
[root@instance2 nebula-graph]# /opt/app/nebula-graph/scripts/nebula.service status all
[INFO] nebula-metad(7458486): Running as 43288, Listening on 9559
[INFO] nebula-graphd(7458486): Running as 43320, Listening on 9669
[INFO] nebula-storaged(7458486): Running as 43408, Listening on 9779
[root@instance2 nebula-graph]#
查询状态 "OFFLINE" 节点失败,已经显示正常 "ONLINE" 状态了。
(root@nebula) [(none)]> SHOW HOSTS STORAGE;
+-------------+------+----------+-----------+--------------+---------+
| Host | Port | Status | Role | Git Info Sha | Version |
+-------------+------+----------+-----------+--------------+---------+
| "127.0.0.1" | 9779 | "ONLINE" | "STORAGE" | "7458486" | "3.8.0" |
+-------------+------+----------+-----------+--------------+---------+
Got 1 rows (time spent 1.198ms/1.961314ms)
Tue, 07 Jan 2025 15:21:41 CST
(root@nebula) [(none)]>
NebulaGraph 服务由 Meta 服务、Graph 服务和 Storage 服务共同提供,这三种服务的配置文件都保存在安装目录的 etc 目录内,默认路径为/usr/local/nebula/etc/,用户可以检查相应的配置文件排查问题。
四、安装 nebula-console
NebulaGraph 支持多种类型的客户端,包括命令行客户端、可视化界面客户端和流行编程语言客户端。详情参见客户端列表。
- 下载 nebula-console
nebula-console 是 NebulaGraph 的命令行客户端工具。在 Assets 区域找到机器运行所需的二进制文件,下载文件到机器上。

https://github.com/vesoft-inc/nebula-console/releases
(版本相同的 NebulaGraph Console 和 NebulaGraph 兼容程度最高,版本不同的 NebulaGraph Console 连接 NebulaGraph 时,可能会有兼容问题,或者无法连接并报错 incompatible version between client and server.)
在 Assets 区域找到机器运行所需的二进制文件,下载文件到机器上。
- 重命名 nebula-console
为方便使用,重命名文件为 nebula-console.
[root@instance2 nebula-graph]# ls
bin data etc logs pids scripts share
[root@instance2 nebula-graph]# ls
bin data etc logs nebula-console-linux-amd64-v3.8.0 pids scripts share
[root@instance2 nebula-graph]# mv nebula-console-linux-amd64-v3.8.0 nebula-console
[root@instance2 nebula-graph]# ls
bin data etc logs nebula-console pids scripts share
[root@instance2 nebula-graph]#
- 授予 nebula-console 权限
在运行 NebulaGraph Console 的机器上执行如下命令,为用户授予 nebula-console 文件的执行权限。
[root@instance2 nebula-graph]# ls
bin data etc logs nebula-console pids scripts share
[root@instance2 nebula-graph]# chmod +x nebula-console
[root@instance2 nebula-graph]# ls
bin data etc logs nebula-console pids scripts share
[root@instance2 nebula-graph]#
或者执行
$ chmod 111 nebula-console
在命令行界面中,切换工作目录至 nebula-console 文件所在目录。
五、连接 NebulaGraph
介绍如何使用原生命令行客户端 NebulaGraph Console 连接 NebulaGraph.
Caution:首次连接到 NebulaGraph 后,必须先注册 Storage 服务,才能正常查询数据。
- 执行如下命令连接 NebulaGraph
[root@instance2 nebula-graph]# ls
bin cluster.id data etc logs nebula-console pids scripts share
[root@instance2 nebula-graph]# ./nebula-console --addr 127.0.0.1 --port 9669 -u root -p nebula
Welcome!
(root@nebula) [(none)]>
参数说明

- 验证安装
为了验证 NebulaGraph 是否成功安装并正常工作,可以尝试连接到图数据库并执行简单的查询。这里我们使用官方提供的命令行工具 nebula-console:
一旦进入控制台,您可以输入 SQL 类似的语句来进行测试:
[root@instance2 nebula-graph]# ./nebula-console --addr 127.0.0.1 --port 9669 -u root -p nebula
Welcome!
(root@nebula) [(none)]> SHOW HOSTS;
+-------------+------+----------+--------------+----------------------+------------------------+---------+
| Host | Port | Status | Leader count | Leader distribution | Partition distribution | Version |
+-------------+------+----------+--------------+----------------------+------------------------+---------+
| "127.0.0.1" | 9779 | "ONLINE" | 0 | "No valid partition" | "No valid partition" | "3.8.0" |
+-------------+------+----------+--------------+----------------------+------------------------+---------+
Got 1 rows (time spent 1.732ms/2.91408ms)
Wed, 08 Jan 2025 11:18:14 CST
(root@nebula) [(none)]>
如果能够顺利创建空间、定义标签并插入节点,则说明安装成功。
六、安装 NebulaGraph Studio
NebulaGraph Studio 是 NebulaGraph 的可视化工具。可以从官方 CDN 地址下载 RPM 包并安装:
- 下载 NebulaGraph Studio
wget https://oss-cdn.nebula-graph.com.cn/nebula-graph-studio/3.8.0/nebula-graph-studio-3.8.0.x86_64.rpm
[root@instance2 soft]# wget https://oss-cdn.nebula-graph.com.cn/nebula-graph-studio/3.8.0/nebula-graph-studio-3.8.0.x86_64.rpm
--2025-01-08 10:13:04-- https://oss-cdn.nebula-graph.com.cn/nebula-graph-studio/3.8.0/nebula-graph-studio-3.8.0.x86_64.rpm
Resolving oss-cdn.nebula-graph.com.cn (oss-cdn.nebula-graph.com.cn)... 220.181.167.219
Connecting to oss-cdn.nebula-graph.com.cn (oss-cdn.nebula-graph.com.cn)|220.181.167.219|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 27310960 (26M) [application/x-rpm]
Saving to: ‘nebula-graph-studio-3.8.0.x86_64.rpm’
100%[======================================================================================>] 27,310,960 15.0MB/s in 1.7s
2025-01-08 10:13:07 (15.0 MB/s) - ‘nebula-graph-studio-3.8.0.x86_64.rpm’ saved [27310960/27310960]
[root@instance2 soft]#
- 安装 NebulaGraph Studio
[root@instance2 soft]# rpm -ivh --prefix=/opt/app/nebula-graph-studio nebula-graph-studio-3.8.0.x86_64.rpm
Preparing... ################################# [100%]
Start installing NebulaGraph Studio now...
Updating / installing...
1:nebula-graph-studio-3.8.0-1 ################################# [100%]
NebulaGraph Studio has been installed.
Created symlink from /etc/systemd/system/multi-user.target.wants/nebula-graph-studio.service to /usr/lib/systemd/system/nebula-graph-studio.service.
NebulaGraph Studio started automatically.
[root@instance2 soft]#
或者,如果希望安装在默认路径下:
sudo rpm -ivh nebula-graph-studio-3.8.0.x86_64.rpm
- 浏览器中访问登录
安装完成后,NebulaGraph Studio 会自动启动。
启动成功后,在浏览器地址栏输入 http://
如果在浏览器窗口中能看到以下登录界面,表示已经成功部署并启动 Studio.
127.0.0.1:7001/login

4. 报错及解决办法
4.1 安装报错
[root@instance2 soft]# rpm -ivh --prefix=/opt/app/nebula-graph-studio nebula-graph-studio-3.8.0.x86_64.rpm
Preparing... ################################# [100%]
/var/tmp/rpm-tmp.w5nIeb: line 2: type: lsof: not found
Install failed for the reason: the command lsof required
error: %pre(nebula-graph-studio-3.8.0-1.x86_64) scriptlet failed, exit status 1
error: nebula-graph-studio-3.8.0-1.x86_64: install failed
[root@instance2 soft]#
4.2 报错缺少 lsof,安装 lsof
[root@instance2 soft]# yum install lsof
4.3 重新尝试安装 nebula-graph-studio

可以正常安装了。
七、性能优化建议
- 调优 JVM 参数:对于 Java 进程(如 Graph 服务),适当调整 JVM 的堆大小和其他相关参数可以显著提升性能。
- 合理规划分区与副本:根据业务特点和数据分布情况,精心设计分区策略和副本因子,以保证高可用性和读写效率。
- 监控与报警:部署监控系统实时跟踪 NebulaGraph 的运行状态,及时发现潜在问题并通过报警机制快速响应。
八、常见问题及解决方案
- 无法启动服务
- 检查日志文件 (/var/log/nebula/) 中是否有错误信息。
- 确认防火墙规则是否允许所需的端口通信。
- 连接超时
- 确保客户端 IP 地址已被正确添加到白名单中。
- 尝试减少查询复杂度或分批提交请求。
- 性能瓶颈
- 分析慢查询日志,识别并优化低效查询。
- 增加硬件资源(如 CPU、内存)或调整配置参数。
通过本文的介绍,相信大家已经掌握了在 CentOS 系统上安装和使用 NebulaGraph 的基本技能,随着实践经验的积累,你一定发现更多有趣的功能和技术细节,从而进一步挖掘图数据库的巨大潜力~
祝你在 NebulaGraph 玩得开心🥳

