跳转至

使用 RPM/DEB 包部署NebulaGraph多机集群

本文介绍通过 RPM 或 DEB 文件部署集群的示例。

Note

用户还可以通过官方工具部署NebulaGraph多机集群。详情参见使用生态工具安装集群

部署方案

机器名称 IP 地址 graphd 进程数量 storaged 进程数量 metad 进程数量
A 192.168.10.111 1 1 1
B 192.168.10.112 1 1 1
C 192.168.10.113 1 1 1
D 192.168.10.114 1 1 -
E 192.168.10.115 1 1 -

前提条件

  • 准备 5 台用于部署集群的机器。
  • 在集群中通过 NTP 服务同步时间。

手动部署流程

安装NebulaGraph

在集群的每一台服务器上都安装NebulaGraph,安装后暂不需要启动服务。安装方式请参见:

修改配置文件

修改每个服务器上的NebulaGraph配置文件。

NebulaGraph的所有配置文件均位于安装目录的etc目录内,包括nebula-graphd.confnebula-metad.confnebula-storaged.conf,用户可以只修改所需服务的配置文件。各个机器需要修改的配置文件如下。

机器名称 待修改配置文件
A nebula-graphd.confnebula-storaged.confnebula-metad.conf
B nebula-graphd.confnebula-storaged.confnebula-metad.conf
C nebula-graphd.confnebula-storaged.confnebula-metad.conf
D nebula-graphd.confnebula-storaged.conf
E nebula-graphd.confnebula-storaged.conf

用户可以参考如下配置文件的内容,仅展示集群通信的部分设置,未展示的内容为默认设置,便于用户了解集群间各个服务器的关系。

Note

主要修改的配置是meta_server_addrs,所有配置文件都需要填写所有 Meta 服务的 IP 地址和端口,同时需要修改local_ip为机器本身的联网 IP 地址。配置参数的详细说明请参见:

  • 机器 A 配置

    • nebula-graphd.conf

      ########## networking ##########
      # Comma separated Meta Server Addresses
      --meta_server_addrs=192.168.10.111:9559,192.168.10.112:9559,192.168.10.113:9559
      # Local IP used to identify the nebula-graphd process.
      # Change it to an address other than loopback if the service is distributed or
      # will be accessed remotely.
      --local_ip=192.168.10.111
      # Network device to listen on
      --listen_netdev=any
      # Port to listen on
      --port=9669
      
    • nebula-storaged.conf

      ########## networking ##########
      # Comma separated Meta server addresses
      --meta_server_addrs=192.168.10.111:9559,192.168.10.112:9559,192.168.10.113:9559
      # Local IP used to identify the nebula-storaged process.
      # Change it to an address other than loopback if the service is distributed or
      # will be accessed remotely.
      --local_ip=192.168.10.111
      # Storage daemon listening port
      --port=9779
      
    • nebula-metad.conf

      ########## networking ##########
      # Comma separated Meta Server addresses
      --meta_server_addrs=192.168.10.111:9559,192.168.10.112:9559,192.168.10.113:9559
      # Local IP used to identify the nebula-metad process.
      # Change it to an address other than loopback if the service is distributed or
      # will be accessed remotely.
      --local_ip=192.168.10.111
      # Meta daemon listening port
      --port=9559
      
  • 机器 B 配置

    • nebula-graphd.conf

      ########## networking ##########
      # Comma separated Meta Server Addresses
      --meta_server_addrs=192.168.10.111:9559,192.168.10.112:9559,192.168.10.113:9559
      # Local IP used to identify the nebula-graphd process.
      # Change it to an address other than loopback if the service is distributed or
      # will be accessed remotely.
      --local_ip=192.168.10.112
      # Network device to listen on
      --listen_netdev=any
      # Port to listen on
      --port=9669
      
    • nebula-storaged.conf

      ########## networking ##########
      # Comma separated Meta server addresses
      --meta_server_addrs=192.168.10.111:9559,192.168.10.112:9559,192.168.10.113:9559
      # Local IP used to identify the nebula-storaged process.
      # Change it to an address other than loopback if the service is distributed or
      # will be accessed remotely.
      --local_ip=192.168.10.112
      # Storage daemon listening port
      --port=9779
      
    • nebula-metad.conf

      ########## networking ##########
      # Comma separated Meta Server addresses
      --meta_server_addrs=192.168.10.111:9559,192.168.10.112:9559,192.168.10.113:9559
      # Local IP used to identify the nebula-metad process.
      # Change it to an address other than loopback if the service is distributed or
      # will be accessed remotely.
      --local_ip=192.168.10.112
      # Meta daemon listening port
      --port=9559
      
  • 机器 C 配置

    • nebula-graphd.conf

      ########## networking ##########
      # Comma separated Meta Server Addresses
      --meta_server_addrs=192.168.10.111:9559,192.168.10.112:9559,192.168.10.113:9559
      # Local IP used to identify the nebula-graphd process.
      # Change it to an address other than loopback if the service is distributed or
      # will be accessed remotely.
      --local_ip=192.168.10.113
      # Network device to listen on
      --listen_netdev=any
      # Port to listen on
      --port=9669
      
    • nebula-storaged.conf

      ########## networking ##########
      # Comma separated Meta server addresses
      --meta_server_addrs=192.168.10.111:9559,192.168.10.112:9559,192.168.10.113:9559
      # Local IP used to identify the nebula-storaged process.
      # Change it to an address other than loopback if the service is distributed or
      # will be accessed remotely.
      --local_ip=192.168.10.113
      # Storage daemon listening port
      --port=9779
      
    • nebula-metad.conf

      ########## networking ##########
      # Comma separated Meta Server addresses
      --meta_server_addrs=192.168.10.111:9559,192.168.10.112:9559,192.168.10.113:9559
      # Local IP used to identify the nebula-metad process.
      # Change it to an address other than loopback if the service is distributed or
      # will be accessed remotely.
      --local_ip=192.168.10.113
      # Meta daemon listening port
      --port=9559
      
  • 机器 D 配置

    • nebula-graphd.conf

      ########## networking ##########
      # Comma separated Meta Server Addresses
      --meta_server_addrs=192.168.10.111:9559,192.168.10.112:9559,192.168.10.113:9559
      # Local IP used to identify the nebula-graphd process.
      # Change it to an address other than loopback if the service is distributed or
      # will be accessed remotely.
      --local_ip=192.168.10.114
      # Network device to listen on
      --listen_netdev=any
      # Port to listen on
      --port=9669
      
    • nebula-storaged.conf

      ########## networking ##########
      # Comma separated Meta server addresses
      --meta_server_addrs=192.168.10.111:9559,192.168.10.112:9559,192.168.10.113:9559
      # Local IP used to identify the nebula-storaged process.
      # Change it to an address other than loopback if the service is distributed or
      # will be accessed remotely.
      --local_ip=192.168.10.114
      # Storage daemon listening port
      --port=9779
      
  • 机器 E 配置

    • nebula-graphd.conf

      ########## networking ##########
      # Comma separated Meta Server Addresses
      --meta_server_addrs=192.168.10.111:9559,192.168.10.112:9559,192.168.10.113:9559
      # Local IP used to identify the nebula-graphd process.
      # Change it to an address other than loopback if the service is distributed or
      # will be accessed remotely.
      --local_ip=192.168.10.115
      # Network device to listen on
      --listen_netdev=any
      # Port to listen on
      --port=9669
      
    • nebula-storaged.conf

      ########## networking ##########
      # Comma separated Meta server addresses
      --meta_server_addrs=192.168.10.111:9559,192.168.10.112:9559,192.168.10.113:9559
      # Local IP used to identify the nebula-storaged process.
      # Change it to an address other than loopback if the service is distributed or
      # will be accessed remotely.
      --local_ip=192.168.10.115
      # Storage daemon listening port
      --port=9779
      

启动集群

依次启动各个服务器上的对应进程。

机器名称 待启动的进程
A graphd、storaged、metad
B graphd、storaged、metad
C graphd、storaged、metad
D graphd、storaged
E graphd、storaged

启动NebulaGraph进程的命令如下:

sudo /usr/local/nebula/scripts/nebula.service start <metad|graphd|storaged|all>

Note

  • 确保每个服务器中的对应进程都已启动,否则服务将启动失败。
  • 当需都启动 graphd、storaged 和 metad 时,可以用 all 代替。
  • /usr/local/nebula是NebulaGraph的默认安装路径,如果修改过安装路径,请使用实际路径。更多启停服务的内容,请参见管理NebulaGraph服务

检查集群

安装原生 CLI 客户端 NebulaGraph Console,然后连接任何一个已启动 graphd 进程的机器,添加 Storage 主机,然后执行命令SHOW HOSTS检查集群状态。例如:

$ ./nebula-console --addr 192.168.10.111 --port 9669 -u root -p nebula

2021/05/25 01:41:19 [INFO] connection pool is initialized successfully
Welcome to NebulaGraph!

> ADD HOSTS 192.168.10.111:9779, 192.168.10.112:9779, 192.168.10.113:9779, 192.168.10.114:9779, 192.168.10.115:9779;
> SHOW HOSTS;
+------------------+------+----------+--------------+----------------------+------------------------+----------------------+
| Host             | Port | Status   | Leader count | Leader distribution  | Partition distribution | Version              |
+------------------+------+----------+--------------+----------------------+------------------------+----------------------+
| "192.168.10.111" | 9779 | "ONLINE" | 0            | "No valid partition" | "No valid partition"   | "3.5.0" |
| "192.168.10.112" | 9779 | "ONLINE" | 0            | "No valid partition" | "No valid partition"   | "3.5.0" |
| "192.168.10.113" | 9779 | "ONLINE" | 0            | "No valid partition" | "No valid partition"   | "3.5.0" |
| "192.168.10.114" | 9779 | "ONLINE" | 0            | "No valid partition" | "No valid partition"   | "3.5.0" |
| "192.168.10.115" | 9779 | "ONLINE" | 0            | "No valid partition" | "No valid partition"   | "3.5.0" |
+------------------+------+----------+--------------+----------------------+------------------------+----------------------+

最后更新: January 31, 2024