Step 1. 启动Nebula容器
docker run --rm -ti --network nebula-docker-compose_nebula-net --entrypoint=/bin/sh vesoft/nebula-console:v2.5.0
Step 2. 连接 Nebula Graph 服务器
nebula-console -u root -p 123456 --address=graphd --port=9669
Step 3. 通过nebula命令行创建图的Schema
DROP SPACE Graph500
CREATE SPACE Graph500(vid_type = FIXED_STRING(128))
USE Graph500
CREATE TAG ve(id int)
CREATE EDGE ed()
Step 4. 获取数据集
wget https://www.galaxybase.com/public/download/graph500.zip && unzip graph500.zip
Step 5. 将测试数据集移动到import目录下并删除表头
sed -i '1d' vertex.csv edge.csv
Step 6. 执行如下命令,等待导入完成
docker run --rm -ti -v /data/nlp/jx/nebula-docker-compose/import/graph500/graph500.yaml:/import/graph500/graph500.yaml -v /data/nlp/jx/nebula-docker-compose/import/graph500:/import/graph500/ vesoft/nebula-importer:v2 --config /import/graph500/graph500.yaml
=============================graph500.yaml=====================================
version: v2
description: g500d
removeTempFiles: false
clientSettings:
retry: 3
concurrency: 20
channelBufferSize: 128
space: Graph500
connection:
user: root
password: 123456
address: 10.6.16.96:9669
postStart:
commands: |
DROP SPACE IF EXISTS Graph500;
CREATE SPACE IF NOT EXISTS Graph500(vid_type = FIXED_STRING(128));
USE Graph500;
CREATE TAG ve(id int);
CREATE EDGE ed();
afterPeriod: 5s
preStop:
commands: |
logPath: ./err/g500d.log
files:
- path: vertex.csv
failDataPath: ./err/ve.csv
batchSize: 2048
inOrder: false
type: csv
csv:
withHeader: false
withLabel: false
delimiter: "\t"
schema:
type: vertex
vertex:
vid:
index: 0
tags:
- name: ve
props:
- name: id
type: int
index: 0
- path: edge.csv
failDataPath: ./err/ed.csv
batchSize: 2048
inOrder: false
type: csv
csv:
withHeader: false
withLabel: false
delimiter: "\t"
schema:
type: edge
edge:
name: ed
srcVID:
index: 0
dstVID:
index: 1
===============================================================================
==============================example.yaml==============================
version: v2
description: example
removeTempFiles:false
clientSettings:
retry:3
concurrency:10
channelBufferSize:128
space: student
connection:
user: root
password: nebula
address:192.168.11.13:9669
postStart:
commands:|
DROP SPACE IF EXISTS student;
CREATE SPACE IF NOT EXISTS student(partition_num=5, replica_factor=1, vid_type=FIXED_STRING(20));
USE student;
CREATE TAG student(name string, age int,gender string);
CREATE EDGE follow(degree int);
afterPeriod:15s
preStop:
commands:|
logPath:./err/test.log
files:
- path:./student_without_header.csv
failDataPath:./err/studenterr.csv
batchSize:10
limit:10
inOrder:true
type: csv
csv:
withHeader:false
withLabel:false
delimiter:","
schema:
type: vertex
vertex:
vid:
index:0
type:string
tags:
- name: student
props:
- name: name
type:string
index:1
- name: age
type:int
index:2
- name: gender
type:string
index:3
- path:./follow_without_header.csv
failDataPath:./err/followerr.csv
batchSize:10
limit:10
inOrder:true
type: csv
csv:
withHeader:false
withLabel:false
schema:
type: edge
edge:
name: follow
withRanking:true
srcVID:
type:string
index:0
dstVID:
type:string
index:1
rank:
index:2
props:
- name: degree
type:double
index:3
===============================================================================