linux 环境:ubuntu 2004
默认gcc 7.5
nebula requerment: g++ 8.5 above
下载source
git clone --branch release-3.8 https://github.com/vesoft-inc/nebula.git
install gcc g++ 11
apt install gcc-11 g++-11
此时 linux环境存在多个版本gcc:7,9.11
查看 gcc --version,显示仍然是7.5.这种情况需要如下配置:
1.
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 110 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 70 --slave /usr/bin/g++ g++ /usr/bin/g++-7 --slave /usr/bin/gcov gcov /usr/bin/gcov-7
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 --slave /usr/bin/g++ g++ /usr/bin/g++-9 --slave /usr/bin/gcov gcov /usr/bin/gcov-9
2.
sudo update-alternatives --config gcc
选择:0
(base) root@ubuntu:/usr/bin# sudo update-alternatives --config gcc
There are 3 choices for the alternative gcc (providing /usr/bin/gcc).Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/gcc-11 110 auto mode
1 /usr/bin/gcc-11 110 manual mode
2 /usr/bin/gcc-7 70 manual mode
3 /usr/bin/gcc-9 90 manual modePress <enter> to keep the current choice[*], or type selection number:
install three part
$ cd nebula/third-party $ ./install-third-party.sh
服务器下载文件失败,从本地下载:
curl https://oss-cdn.nebula-graph.com.cn/third-party/3.3/vesoft-third-party-3.3-x86_64-libc-2.31-gcc-11.2.0-abi-11.sh --output D:\vesoft-third-party-3.3-x86_64-libc-2.31-gcc-11.2.0-abi-11.sh
将文件上传到nebula/thirdpart/
bash vesoft-third-party-3.3-x86_64-libc-2.31-gcc-11.2.0-abi-11.sh
输出:
Nebula Third Party has been installed to /opt/vesoft/third-party/3.3
make
cd ..
mkdir build && cd buildcmake -DCMAKE_INSTALL_PREFIX=/usr/local/nebula -DENABLE_TESTING=OFF -DCMAKE_BUILD_TYPE=Release ..
加快mk速度:
查看CPU核数:
(base) root@ubuntu:/data/nebula3.8/nebula/build# cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l
32
(base) root@ubuntu:/data/nebula3.8/nebula/build# cat /proc/cpuinfo| grep "cpu cores"| uniq
cpu cores : 1
(base) root@ubuntu:/data/nebula3.8/nebula/build# cat /proc/cpuinfo| grep "processor"| wc -l
32
(base) root@ubuntu:/data/nebula3.8/nebula/build# free
total used free shared buff/cache available
Mem: 65845892 1874080 12186732 6240 51785080 63268188
衡量内存和CPU数据,确认N为32
N = 32
参考:make -j{N} # E.g., make -j2
执行下面命令:make -j32
创建配置文件三个:
cd /usr/local/nebula/etc
cp nebula-graphd.conf.default nebula-graphd.conf
cp nebula-metad.conf.default nebula-metad.conf
cp nebula-storaged.conf.default nebula-storaged.conf
启动服务:
sudo /usr/local/nebula/scripts/nebula.service start all
netstat -nplt
(base) root@ubuntu:/usr/local/nebula/etc# netstat -nplt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:19559 0.0.0.0:* LISTEN 1909079/nebula-meta
tcp 0 0 127.0.0.1:44041 0.0.0.0:* LISTEN 1658097/python
tcp 0 0 127.0.0.1:40495 0.0.0.0:* LISTEN 1658097/python
tcp 0 0 127.0.0.1:60975 0.0.0.0:* LISTEN 1658097/python
tcp 0 0 127.0.0.1:50707 0.0.0.0:* LISTEN 1658097/python
tcp 0 0 10.255.132.22:60020 0.0.0.0:* LISTEN 1740/./gse_agent
tcp 0 0 0.0.0.0:19669 0.0.0.0:* LISTEN 1909140/nebula-grap
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 938/systemd-resolve
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1119/sshd: /usr/sbi
tcp 0 0 127.0.0.1:43799 0.0.0.0:* LISTEN 1658097/python
tcp 0 0 0.0.0.0:8701 0.0.0.0:* LISTEN 1657354/python
tcp 0 0 127.0.0.1:46655 0.0.0.0:* LISTEN 1658097/python
tcp6 0 0 :::9669 :::* LISTEN 1909140/nebula-grap
tcp6 0 0 :::9835 :::* LISTEN 1037/nvidia_gpu_exp
tcp6 0 0 :::9100 :::* LISTEN 1044/node_exporter
tcp6 0 0 :::22 :::* LISTEN 1119/sshd: /usr/sbi
tcp6 0 0 :::9559 :::* LISTEN 1909079/nebula-meta
tcp6 0 0 :::9560 :::* LISTEN 1909079/nebula-meta
tcp6 0 0 :::3000 :::* LISTEN 2130337/grafana
tcp6 0 0 :::8701 :::* LISTEN 1657354/python
服务管理:参考
$ sudo /usr/local/nebula/scripts/nebula.service
[-v] [-c <config_file_path>]
<start | stop | restart | kill | status>
<metad | graphd | storaged | all>
检查状态:
(base) root@ubuntu:/usr/local/nebula/etc# sudo /usr/local/nebula/scripts/nebula.service status all
[WARN] The maximum files allowed to open might be too few: 1024
[INFO] nebula-metad(fa928930a): Running as 1909079, Listening on 9559
[INFO] nebula-graphd(fa928930a): Running as 1909140, 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(fa928930a): Running as 1909205, Listening on 9779
下载 nebula-console 二进制文件:
https://github.com/vesoft-inc/nebula-console/releases/download/v3.8.0/nebula-console-linux-amd64-v3.8.0
起名为:nebula-console-shell
chmod 777 nebula-console-shell
链接数据库:
sudo ./nebula-console-shell -addr 127.0.0.1 -port 9669 -u root -p nebula
退出 “:quit”