管理Nebula Graph服务

Nebula Graph使用脚本nebula.service管理服务,包括启动、停止、重启、中止和查看。

nebula.service的默认路径是/usr/local/nebula/scripts,如果修改过安装路径,请使用实际路径。

语法

  1. $ sudo /usr/local/nebula/scripts/nebula.service
  2. [-v] [-c <config_file_path>]
  3. <start|stop|restart|kill|status>
  4. <metad|graphd|storaged|all>
参数说明
-v显示详细调试信息。
-c指定配置文件路径,默认路径为/usr/local/nebula/etc/
start启动服务。
stop停止服务。
restart重启服务。
kill中止服务。
status查看服务状态。
metad管理Meta服务。
graphd管理Graph服务。
storaged管理Storage服务。
all管理所有服务。

启动Nebula Graph服务

非容器部署

对于使用RPM或DEB文件安装的Nebula Graph,执行如下命令启动服务:

  1. $ sudo /usr/local/nebula/scripts/nebula.service start all
  2. [INFO] Starting nebula-metad...
  3. [INFO] Done
  4. [INFO] Starting nebula-graphd...
  5. [INFO] Done
  6. [INFO] Starting nebula-storaged...
  7. [INFO] Done

容器部署

对于使用Docker Compose部署的Nebula Graph,在nebula-docker-compose/目录内执行如下命令启动服务:

  1. [nebula-docker-compose]$ docker-compose up -d
  2. Building with native build. Learn about native build in Compose here: https://docs.docker.com/go/compose-native-build/
  3. Creating network "nebula-docker-compose_nebula-net" with the default driver
  4. Creating nebula-docker-compose_metad0_1 ... done
  5. Creating nebula-docker-compose_metad2_1 ... done
  6. Creating nebula-docker-compose_metad1_1 ... done
  7. Creating nebula-docker-compose_storaged2_1 ... done
  8. Creating nebula-docker-compose_graphd1_1 ... done
  9. Creating nebula-docker-compose_storaged1_1 ... done
  10. Creating nebula-docker-compose_storaged0_1 ... done
  11. Creating nebula-docker-compose_graphd2_1 ... done
  12. Creating nebula-docker-compose_graphd_1 ... done

停止Nebula Graph服务

Danger

请勿使用kill -9 命令强制终止进程,否则可能较小概率出现数据丢失。

非容器部署

执行如下命令停止Nebula Graph服务:

  1. $ sudo /usr/local/nebula/scripts/nebula.service stop all
  2. [INFO] Stopping nebula-metad...
  3. [INFO] Done
  4. [INFO] Stopping nebula-graphd...
  5. [INFO] Done
  6. [INFO] Stopping nebula-storaged...
  7. [INFO] Done

容器部署

nebula-docker-compose/目录内执行如下命令停止Nebula Graph服务:

  1. nebula-docker-compose]$ docker-compose down
  2. Stopping nebula-docker-compose_graphd_1 ... done
  3. Stopping nebula-docker-compose_graphd2_1 ... done
  4. Stopping nebula-docker-compose_storaged0_1 ... done
  5. Stopping nebula-docker-compose_storaged1_1 ... done
  6. Stopping nebula-docker-compose_graphd1_1 ... done
  7. Stopping nebula-docker-compose_storaged2_1 ... done
  8. Stopping nebula-docker-compose_metad1_1 ... done
  9. Stopping nebula-docker-compose_metad2_1 ... done
  10. Stopping nebula-docker-compose_metad0_1 ... done
  11. Removing nebula-docker-compose_graphd_1 ... done
  12. Removing nebula-docker-compose_graphd2_1 ... done
  13. Removing nebula-docker-compose_storaged0_1 ... done
  14. Removing nebula-docker-compose_storaged1_1 ... done
  15. Removing nebula-docker-compose_graphd1_1 ... done
  16. Removing nebula-docker-compose_storaged2_1 ... done
  17. Removing nebula-docker-compose_metad1_1 ... done
  18. Removing nebula-docker-compose_metad2_1 ... done
  19. Removing nebula-docker-compose_metad0_1 ... done
  20. Removing network nebula-docker-compose_nebula-net

Note

命令docker-compose down -v将会删除所有本地Nebula Graph的数据。如果使用的是developing或nightly版本,并且有一些兼容性问题,请尝试这个命令。

查看Nebula Graph服务

非容器部署

执行如下命令查看Nebula Graph服务状态:

  1. $ sudo /usr/local/nebula/scripts/nebula.service status all
  • 如果返回如下结果,表示Nebula Graph服务正常运行。

    1. [INFO] nebula-metad: Running as 26601, Listening on 9559
    2. [INFO] nebula-graphd: Running as 26644, Listening on 9669
    3. [INFO] nebula-storaged: Running as 26709, Listening on 9779
  • 如果返回类似如下结果,表示Nebula Graph服务异常,可以根据异常服务信息进一步排查,或者在Nebula Graph社区寻求帮助。

    1. [INFO] nebula-metad: Running as 25600, Listening on 9559
    2. [INFO] nebula-graphd: Exited
    3. [INFO] nebula-storaged: Running as 25646, Listening on 9779

Nebula Graph服务由Meta服务、Graph服务和Storage服务共同提供,这三种服务的配置文件都保存在安装目录的etc目录内,默认路径为/usr/local/nebula/etc/,用户可以检查相应的配置文件排查问题。

容器部署

nebula-docker-compose目录内执行如下命令查看Nebula Graph服务状态:

  1. nebula-docker-compose]$ docker-compose ps
  2. Name Command State Ports
  3. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------
  4. nebula-docker-compose_graphd1_1 /usr/local/nebula/bin/nebu ... Up (healthy) 0.0.0.0:49223->19669/tcp, 0.0.0.0:49222->19670/tcp, 0.0.0.0:49224->9669/tcp
  5. nebula-docker-compose_graphd2_1 /usr/local/nebula/bin/nebu ... Up (healthy) 0.0.0.0:49229->19669/tcp, 0.0.0.0:49228->19670/tcp, 0.0.0.0:49230->9669/tcp
  6. nebula-docker-compose_graphd_1 /usr/local/nebula/bin/nebu ... Up (healthy) 0.0.0.0:49221->19669/tcp, 0.0.0.0:49220->19670/tcp, 0.0.0.0:9669->9669/tcp
  7. nebula-docker-compose_metad0_1 ./bin/nebula-metad --flagf ... Up (healthy) 0.0.0.0:49212->19559/tcp, 0.0.0.0:49211->19560/tcp, 0.0.0.0:49213->9559/tcp,
  8. 9560/tcp
  9. nebula-docker-compose_metad1_1 ./bin/nebula-metad --flagf ... Up (healthy) 0.0.0.0:49209->19559/tcp, 0.0.0.0:49208->19560/tcp, 0.0.0.0:49210->9559/tcp,
  10. 9560/tcp
  11. nebula-docker-compose_metad2_1 ./bin/nebula-metad --flagf ... Up (healthy) 0.0.0.0:49206->19559/tcp, 0.0.0.0:49205->19560/tcp, 0.0.0.0:49207->9559/tcp,
  12. 9560/tcp
  13. nebula-docker-compose_storaged0_1 ./bin/nebula-storaged --fl ... Up (healthy) 0.0.0.0:49218->19779/tcp, 0.0.0.0:49217->19780/tcp, 9777/tcp, 9778/tcp,
  14. 0.0.0.0:49219->9779/tcp, 9780/tcp
  15. nebula-docker-compose_storaged1_1 ./bin/nebula-storaged --fl ... Up (healthy) 0.0.0.0:49215->19779/tcp, 0.0.0.0:49214->19780/tcp, 9777/tcp, 9778/tcp,
  16. 0.0.0.0:49216->9779/tcp, 9780/tcp
  17. nebula-docker-compose_storaged2_1 ./bin/nebula-storaged --fl ... Up (healthy) 0.0.0.0:49226->19779/tcp, 0.0.0.0:49225->19780/tcp, 9777/tcp, 9778/tcp,
  18. 0.0.0.0:49227->9779/tcp, 9780/tcp

如果服务有异常,用户可以先确认异常的容器名称(例如nebula-docker-compose_graphd2_1),

然后执行docker ps查看对应的CONTAINER ID(示例为2a6c56c405f5)。

  1. [nebula-docker-compose]$ docker ps
  2. CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
  3. 2a6c56c405f5 vesoft/nebula-graphd:v2-nightly "/usr/local/nebula/b…" 36 minutes ago Up 36 minutes (healthy) 0.0.0.0:49230->9669/tcp, 0.0.0.0:49229->19669/tcp, 0.0.0.0:49228->19670/tcp nebula-docker-compose_graphd2_1
  4. 7042e0a8e83d vesoft/nebula-storaged:v2-nightly "./bin/nebula-storag…" 36 minutes ago Up 36 minutes (healthy) 9777-9778/tcp, 9780/tcp, 0.0.0.0:49227->9779/tcp, 0.0.0.0:49226->19779/tcp, 0.0.0.0:49225->19780/tcp nebula-docker-compose_storaged2_1
  5. 18e3ea63ad65 vesoft/nebula-storaged:v2-nightly "./bin/nebula-storag…" 36 minutes ago Up 36 minutes (healthy) 9777-9778/tcp, 9780/tcp, 0.0.0.0:49219->9779/tcp, 0.0.0.0:49218->19779/tcp, 0.0.0.0:49217->19780/tcp nebula-docker-compose_storaged0_1
  6. 4dcabfe8677a vesoft/nebula-graphd:v2-nightly "/usr/local/nebula/b…" 36 minutes ago Up 36 minutes (healthy) 0.0.0.0:49224->9669/tcp, 0.0.0.0:49223->19669/tcp, 0.0.0.0:49222->19670/tcp nebula-docker-compose_graphd1_1
  7. a74054c6ae25 vesoft/nebula-graphd:v2-nightly "/usr/local/nebula/b…" 36 minutes ago Up 36 minutes (healthy) 0.0.0.0:9669->9669/tcp, 0.0.0.0:49221->19669/tcp, 0.0.0.0:49220->19670/tcp nebula-docker-compose_graphd_1
  8. 880025a3858c vesoft/nebula-storaged:v2-nightly "./bin/nebula-storag…" 36 minutes ago Up 36 minutes (healthy) 9777-9778/tcp, 9780/tcp, 0.0.0.0:49216->9779/tcp, 0.0.0.0:49215->19779/tcp, 0.0.0.0:49214->19780/tcp nebula-docker-compose_storaged1_1
  9. 45736a32a23a vesoft/nebula-metad:v2-nightly "./bin/nebula-metad …" 36 minutes ago Up 36 minutes (healthy) 9560/tcp, 0.0.0.0:49213->9559/tcp, 0.0.0.0:49212->19559/tcp, 0.0.0.0:49211->19560/tcp nebula-docker-compose_metad0_1
  10. 3b2c90eb073e vesoft/nebula-metad:v2-nightly "./bin/nebula-metad …" 36 minutes ago Up 36 minutes (healthy) 9560/tcp, 0.0.0.0:49207->9559/tcp, 0.0.0.0:49206->19559/tcp, 0.0.0.0:49205->19560/tcp nebula-docker-compose_metad2_1
  11. 7bb31b7a5b3f vesoft/nebula-metad:v2-nightly "./bin/nebula-metad …" 36 minutes ago Up 36 minutes (healthy) 9560/tcp, 0.0.0.0:49210->9559/tcp, 0.0.0.0:49209->19559/tcp, 0.0.0.0:49208->19560/tcp nebula-docker-compose_metad1_1

最后登录容器排查问题

  1. [nebula-docker-compose]$ docker exec -it 2a6c56c405f5 bash
  2. [root@2a6c56c405f5 nebula]#

下一步

连接Nebula Graph


最后更新: August 25, 2021