安装图数据库Nebula Graph

本文详细描述了如何在遵循国产化技术路线和信创要求的前提下,安装、配置及管理NebulaGraph,包括单机部署、分布式部署,以及安装NebulaGraphStudio和NebulaGraphDashboard的过程。
摘要由CSDN通过智能技术生成

前言

今年开始,很多机关单位、央国企都要求所有新建的信息系统必须走国产化技术路线,而且还要求满足“信创”要求。“信创”通俗来讲就是要自研,那种拿个开源套壳的都不满足信创要求。之前研究了一段时间的neo4j,显然neo4j不满足国产化技术路线。刚好前一段时间和Nebula Graph的技术人员交流,顺便也就安装研究一下。

本地安装

Nebula为客户提供了多种安装方式,包括rpm包、源码安装、docker compose安装等。这里我们用比较简单的rpm包方式。

在Nebula官网选择对应的版本下载即可。

单机部署

这里我上传rpm包到linux服务器上,然后安装:

rpm -i --prefix=/software/nebula nebula-graph-3.6.0.el7.x86_64.rpm

通过命令启动

/software/nebula/scripts/nebula.service start all

可以通过以下命令查看服务状态:

/software/nebula/scripts/nebula.service status all

分布式部署

和单机部署差不多,但是每台机器都需要改一下配置文件,笔者把graph、meta、storage服务在192.168.23.129-131这三台机器上都部署了,所以配置文件要进行以下修改:

192.168.23.129的nebula-graphd.conf:

########## networking ##########
# Comma separated Meta Server Addresses
--meta_server_addrs=192.168.23.129:9559,192.168.23.130:9559,192.168.23.131: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.23.129
# Network device to listen on
--listen_netdev=any
# Port to listen on
--port=9669

192.168.23.129的nebula-storaged.conf

########## networking ##########
# Comma separated Meta server addresses
--meta_server_addrs=192.168.23.129:9559,192.168.23.130:9559,192.168.23.131: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.23.129
# Storage daemon listening port
--port=9779

192.168.23.130的nebula-metad.conf

########## networking ##########
# Comma separated Meta Server addresses
--meta_server_addrs=192.168.23.129:9559,192.168.23.130:9559,192.168.23.131: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.23.129
# Meta daemon listening port
--port=9559

192.168.23.130和131的配置也类似,除了local_ip要改成对应本机ip以外。

安装NebulaGraph Studio

NebulaGraph Studio是NebulaGraph的图形化客户端。建议安装它来学习和管理数据库。

同样在官网的操作手册可以下载对应的rpm包。

安装rpm包:

rpm -i --prefix=/software/nebula-studio nebula-graph-studio-3.8.0.x86_64.rpm

安装后通常会触发自动启动,会有以下文字:

Start installing NebulaGraph Studio now...
NebulaGraph Studio has been installed.
NebulaGraph Studio started automatically.

当然也可以通过手动启动,进入其scripts目录下调用start.sh脚本即可。

打开浏览器,输入NebulaGraph Studio所在的ip和端口,笔者这里是http://192.168.23.129:7001/

ip为NebulaGraph的ip,笔者同样安装在192.168.23.129下。默认的用户名密码为:root/nebula

注册Storage服务

Nebula Storage是负责Nebula存储服务的组件。上一步虽然我们已经成功启动,但如果想添加命名空间时,会报“Host not enough”。首次使用时要注册Stroage服务。在NebulaGraph Studio界面的console命令行这里执行:

ADD HOSTS <ip>:<port>

 加了之后可以看通过SHOW HOSTS STORAGE命令查看状态:

如果是新加的话是OFFLINE状态,这样重启一下就可以了:

./nebula.service restart all

安装NebulaGraph Dashboard(社区版)

NebulaGraph Dashboard是一款用于监控 NebulaGraph 集群中机器和服务状态的可视化工具。

安装前要先保障NebulaGraph已安装并启动,并且在待监控的机器上安装node-exporter并启动。

node-exporter的安装参考 Prometheus文档

 在官网下载安装包

解压后进入文件夹,打开config.yml,主要是配置需要监控的各组件的ip

port: 7003   # Web 服务端口。
gateway:
  ip: 192.168.23.129   # 部署 Dashboard 的机器 IP。
  port: 8090
  https: false  # 是否为 HTTPS 端口。
  runmode: dev  # 程序运行模式,包括 dev、test、prod。一般用于区分不同运行环境。
stats-exporter:
  ip: 192.168.23.129   # 部署 Dashboard 的机器 IP。
  nebulaPort: 9200
  https: false  # 是否为 HTTPS 端口。
node-exporter:
  - ip: 192.168.23.129 # 部署 NebulaGraph 的机器 IP。
    port: 9100
    https: false # 是否为 HTTPS 端口。
# - ip: nebulaHostIP_2
#   port: 9100
#   https: false
prometheus:
  ip: 192.168.23.129    # 部署 Dashboard 的机器 IP。
  prometheusPort: 9090
  https: false  # 是否为 HTTPS 端口。
  scrape_interval: 5s  # 收集监控数据的间隔时间。默认为 1 分钟。
  evaluation_interval: 5s  # 告警规则扫描时间间隔。默认为 1 分钟。
# 集群节点信息
nebula-cluster:
  name: 'default' # 集群名称
  metad:
    - name: metad0
      endpointIP: 192.168.23.129  # 部署 Meta 服务的机器 IP。
      port: 9559
      endpointPort: 19559
  # - name: metad1
  #   endpointIP: nebulaMetadIP
  #   port: 9559
  #   endpointPort: 19559  
  graphd:
    - name: graphd0
      endpointIP: 192.168.23.129  # 部署 Graph 服务的机器 IP。
      port: 9669
      endpointPort: 19669
  # - name: graphd1
  #   endpointIP: GraphdIP
  #   port: 9669
  #   endpointPort: 19669  
  storaged:
    - name: storaged0
      endpointIP: 192.168.23.129  # 部署 Storage 服务的机器 IP。
      port: 9779
      endpointPort: 19779
  # - name: storaged1
  #   endpointIP: StoragedIP
  #   port: 9779
  #   endpointPort: 19779  

本文都安装在一台机器上,所有所有ip都改成192.168.23.169。在确保服务都起来的情况下,启动dashboard:

./dashboard.sh restart all

浏览器打开页面

默认账号密码是root/nebula。

PS:如果在连接时报“数据库连接有误,请重新配置”。通过netstat检查各组件的端口是否已在监听。然后重启dashboard并刷新页面,再登陆即可。

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值