Ubuntu local deployment Nebula graph database
OS: Ubuntu 20.04
Hardware architecture: x86_64
Software version: nebula-graph-3.0.2, nebula-graph-studio-3.2.3
Official website: https://nebula-graph.com.cn/
Install Nebula Graph core service
-
Visit the official manual , download and install the nebula-graph installation package using the following instructions according to the tutorial:
wget https://oss-cdn.nebula-graph.com.cn/package/3.0.2/nebula-graph-3.0.2.ubuntu2004.amd64.deb sudo dpkg -i nebula-graph-3.0.2.ubuntu2004.amd64.deb
-
Start the nebula-graph service with the following command:
sudo /usr/local/nebula/scripts/nebula.service start all
To stop the nebula-graph service, change start to stop:
sudo /usr/local/nebula/scripts/nebula.service stop all
-
Use the following command to view the status of the nebula-graph service:
sudo /usr/local/nebula/scripts/nebula.service status all
Normal output:
[INFO] nebula-metad(02b2091): Running as 26601, Listening on 9559 [INFO] nebula-graphd(02b2091): Running as 26644, Listening on 9669 [INFO] nebula-storaged(02b2091): Running as 26709, Listening on 9779
Install the Nebula client
Nebula has two free clients: Nebula Console and Nebula Graph Studio . Among them, Nebula Console is a command-line tool. It uses nGQL commands to operate and cannot be visualized. Therefore, it will not be expanded here. You can refer to the manual and github page .
Here's how to install Nebula Graph Studio .
- First use
sudo /usr/local/nebula/scripts/nebula.service start all
the command to ensure that the nebula-graph service has been started; - Visit the official website , download the latest version of Nebula Graph Studio, and use
sudo dpkg -i 安装包路径
the command to install; - Open the browser, visit http://127.0.0.1:7001 , if you see the login interface, it means the installation is successful.
Using the Nebula Graph Studio client
-
First, you need to prepare the data. Here we use the official sample data, visit basketballplayer , download and decompress the original data table in csv format;
-
Log in to Nebula Graph Studio in the browser, enter Host:
127.0.0.1:9669
, user name:root
, enter password casually, and log in; -
Click the "Schema" tab, click the plus sign to create a graph space, name it
basketballplayer
, select vid typeFIXED_STRING
, length is64
, add description at will, and finally click Create below;
-
After the creation is complete, return to the graph space list of the "Schema" label. In
basketballplayer
the "Operation" column on the far right, click the wrench icon to enter the settings. On the left are labels, edge types, and indexes. Create labels first; -
Click "Create" in "Label/List", enter the name
player
, add two attributes, namelystring
typename
and ``int类型的
age`, and click "Create" at the bottom;
-
Switch to "edge type/list", here you need to create two kinds of edges, the first name is
follow
, the attribute is ``int类型的
degree;第二个名称为
serve,属性为两个
int类型的
start_year和
end_year`;
-
Switch to the "Import" tab, select the newly created
basketballplayer
map space, and in the next step, click "Upload File" on the right, select the file you just decompressed, and upload all; -
The next step is the connection point, first bind the data source in the upper right corner: vertex_player.csv, after confirmation, "data source 1" appears, click "+Tag" at the bottom, select "
vertexId
column0", TAG selectionplayer
, attributename
andage
corresponding selection respectively "column2" and "column1"; after completion, continue to bind the data source in the upper right corner: vertex_team.csv, and complete the selection according to the steps just now;
-
The next step is the associated edge, first bind the data source in the upper right corner: edge_server.csv, after confirmation, "Edge1" appears, select the type,
server
thensrcId
,dstId
,start_year
,end_year
respectively select "column0", "column1", "column2", "column3" ,rank
don’t choose, just ignore it; after completion, continue to bind the data source in the upper right corner: edge_follow.csv, and complete the selection according to the steps just now; -
The last step is import. After clicking "Import", you can see the import process in the log tab. My import log is as follows:
# basketballplayer导入LOG 2022/04/19 11:16:36 [INFO] clientmgr.go:28: Create 10 Nebula Graph clients 2022/04/19 11:16:36 [INFO] reader.go:64: Start to read file(0): /usr/local/nebula-graph-studio/data/upload/vertex_player.csv, schema: < :VID(string),player.age:int,player.name:string > 2022/04/19 11:16:36 [INFO] reader.go:64: Start to read file(1): /usr/local/nebula-graph-studio/data/upload/vertex_team.csv, schema: < :VID(string),team.name:string > 2022/04/19 11:16:36 [INFO] reader.go:180: Total lines of file(/usr/local/nebula-graph-studio/data/upload/vertex_player.csv) is: 51, error lines: 0 2022/04/19 11:16:36 [INFO] reader.go:180: Total lines of file(/usr/local/nebula-graph-studio/data/upload/vertex_team.csv) is: 30, error lines: 0 2022/04/19 11:16:36 [INFO] reader.go:64: Start to read file(3): /usr/local/nebula-graph-studio/data/upload/edge_serve.csv, schema: < :SRC_VID(string),:DST_VID(string),serve.start_year:int,serve.end_year:int > 2022/04/19 11:16:36 [INFO] reader.go:64: Start to read file(2): /usr/local/nebula-graph-studio/data/upload/edge_follow.csv, schema: < :SRC_VID(string),:DST_VID(string),follow.degree:int > 2022/04/19 11:16:36 [INFO] reader.go:180: Total lines of file(/usr/local/nebula-graph-studio/data/upload/edge_follow.csv) is: 81, error lines: 0 2022/04/19 11:16:36 [INFO] reader.go:180: Total lines of file(/usr/local/nebula-graph-studio/data/upload/edge_serve.csv) is: 152, error lines: 0 2022/04/19 11:16:36 [INFO] statsmgr.go:62: Done(/usr/local/nebula-graph-studio/data/upload/vertex_player.csv): Time(0.01s), Finished(51), Failed(0), Read Failed(0), Latency AVG(1183us), Batches Req AVG(1335us), Rows AVG(3721.61/s) 2022/04/19 11:16:36 [INFO] statsmgr.go:62: Done(/usr/local/nebula-graph-studio/data/upload/vertex_team.csv): Time(0.01s), Finished(81), Failed(0), Read Failed(0), Latency AVG(844us), Batches Req AVG(989us), Rows AVG(5633.51/s) 2022/04/19 11:16:36 [INFO] statsmgr.go:62: Done(/usr/local/nebula-graph-studio/data/upload/edge_follow.csv): Time(0.02s), Finished(299), Failed(0), Read Failed(0), Latency AVG(1058us), Batches Req AVG(1201us), Rows AVG(17351.25/s) 2022/04/19 11:16:36 [INFO] statsmgr.go:62: Done(/usr/local/nebula-graph-studio/data/upload/edge_serve.csv): Time(0.02s), Finished(314), Failed(0), Read Failed(0), Latency AVG(1068us), Batches Req AVG(1211us), Rows AVG(18177.00/s)
-
After the import is complete, switch to the "Graph Exploration" tab, click "Start Exploration" -> "Sample Import", several nodes will appear randomly, select any node, and in the "Extension Condition" panel on the right, set the "Direction" to It is "two-way", the number of steps is set to 2, and click "Expand" to see the effect of the picture.
If the number of steps is set too large, it may cause calculation overflow and system crash. In this case, you need to restart the system by running in the terminal
sudo /usr/local/nebula/scripts/nebula.service start all
.
I will write another article about importing and testing the twitter2010 social attention dataset in Nebula later , so stay tuned!