Ubuntu local deployment Nebula graph database

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

  1. 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
    
  2. 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
    
  3. 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 .

  1. First use sudo /usr/local/nebula/scripts/nebula.service start allthe command to ensure that the nebula-graph service has been started;
  2. Visit the official website , download the latest version of Nebula Graph Studio, and use sudo dpkg -i 安装包路径the command to install;
  3. Open the browser, visit http://127.0.0.1:7001 , if you see the login interface, it means the installation is successful.
    insert image description here

Using the Nebula Graph Studio client

  1. 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;

  2. 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;

  3. Click the "Schema" tab, click the plus sign to create a graph space, name it basketballplayer, select vid type FIXED_STRING, length is 64, add description at will, and finally click Create below;
    Schema creates a graph space

  4. After the creation is complete, return to the graph space list of the "Schema" label. In basketballplayerthe "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;

  5. Click "Create" in "Label/List", enter the name player, add two attributes, namely stringtype nameand ``int 类型的age`, and click "Create" at the bottom;
    label list

  6. 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`;
    list of edge types

  7. Switch to the "Import" tab, select the newly created basketballplayermap space, and in the next step, click "Upload File" on the right, select the file you just decompressed, and upload all;

  8. 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 " vertexIdcolumn0", TAG selection player, attribute nameand agecorresponding 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;
    connection point

  9. 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, serverthen srcId, dstId, start_year, end_yearrespectively select "column0", "column1", "column2", "column3" , rankdon’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;

  10. 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)
    
  11. 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.
    graph exploration

    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!

Guess you like

Origin blog.csdn.net/liuqixuan1994/article/details/124475258