使用RPM/DEB包部署Nebula Graph集群

Nebula Graph不提供官方的集群部署工具,用户可以使用RPM或DEB文件手动部署集群。本文提供了部署集群的示例。

部署方案

机器名称IP地址graphd进程数量storaged进程数量metad进程数量
A192.168.10.111111
B192.168.10.112111
C192.168.10.113111
D192.168.10.11411-
E192.168.10.11511-

前提条件

准备5台用于部署集群的机器。

手动部署流程

1.安装Nebula Graph

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

2.修改配置文件

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

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

机器名称待修改配置文件
Anebula-graphd.confnebula-storaged.confnebula-metad.conf
Bnebula-graphd.confnebula-storaged.confnebula-metad.conf
Cnebula-graphd.confnebula-storaged.confnebula-metad.conf
Dnebula-graphd.confnebula-storaged.conf
Enebula-graphd.confnebula-storaged.conf

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

Note

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

  • Meta服务配置

  • Graph服务配置

  • Storage服务配置

  • 机器A配置

    • nebula-graphd.conf

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

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

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

    • nebula-graphd.conf

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

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

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

    • nebula-graphd.conf

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

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

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

    • nebula-graphd.conf

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

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

    • nebula-graphd.conf

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

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

3.启动集群

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

机器名称待启动的进程
Agraphd、storaged、metad
Bgraphd、storaged、metad
Cgraphd、storaged、metad
Dgraphd、storaged
Egraphd、storaged

启动Nebula Graph进程的命令如下:

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

Note

  • graphd、storaged和metad都启动时,可以用all代替。

  • /usr/local/nebula是Nebula Graph的默认安装路径,如果修改过安装路径,请使用实际路径。更多启停服务的内容,请参见管理Nebula Graph服务

4.检查集群

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

  1. $ ./nebula-console --addr 192.168.10.111 --port 9669 -u root -p nebula
  2. 2021/05/25 01:41:19 [INFO] connection pool is initialized successfully
  3. Welcome to Nebula Graph!
  4. > SHOW HOSTS;
  5. +------------------+------+----------+--------------+----------------------+------------------------+
  6. | Host | Port | Status | Leader count | Leader distribution | Partition distribution |
  7. +------------------+------+----------+--------------+----------------------+------------------------+
  8. | "192.168.10.111" | 9779 | "ONLINE" | 0 | "No valid partition" | "No valid partition" |
  9. +------------------+------+----------+--------------+----------------------+------------------------+
  10. | "192.168.10.112" | 9779 | "ONLINE" | 0 | "No valid partition" | "No valid partition" |
  11. +------------------+------+----------+--------------+----------------------+------------------------+
  12. | "192.168.10.113" | 9779 | "ONLINE" | 0 | "No valid partition" | "No valid partition" |
  13. +------------------+------+----------+--------------+----------------------+------------------------+
  14. | "192.168.10.114" | 9779 | "ONLINE" | 0 | "No valid partition" | "No valid partition" |
  15. +------------------+------+----------+--------------+----------------------+------------------------+
  16. | "192.168.10.115" | 9779 | "ONLINE" | 0 | "No valid partition" | "No valid partition" |
  17. +------------------+------+----------+--------------+----------------------+------------------------+
  18. | "Total" | | | 0 | | |
  19. +------------------+------+----------+--------------+----------------------+------------------------+

最后更新: August 18, 2021