
目录
1. 是什么
2. 安装
2.1. 配置 go 语言环境
2.2. 下载、编译 Nebula Importer
3. 使用1. 是什么
Nebula Importer (Importer) is a standalone import tool for CSV files with Nebula Graph. Importer can read the local CSV file and then import the data into the Nebula Graph database. (Nebula Importer 是一个支持把 CSV 文件导入 Nebula 图数据库的工具)
2. 安装
2.1. 配置 go 语言环境

tar -xvf ./go1.17.2.linux-amd64.tar.gz
mv go /usr/local/govim ~/.bashrcexport GOROOT=/usr/local/go
export GOPATH=$HOME/go
export GO111MODULE=on
export GOPROXY=https://goproxy.cn
export PATH=$PATH:$GOROOT/bin:$GOPATH/binsource ~/.bashrc
go version
2.2. 下载、编译 Nebula Importer
git clone https://github.com/vesoft-inc/nebula-importer.git
cd nebula-importer
make build
验证

3. 使用

version: v2
description: rational drug v2
removeTempFiles: false
clientSettings:
retry: 3
concurrency: 3 # number of graph clients
channelBufferSize: 1
space: rational_drug_v2
connection:
user: root
password: nebula
address: 10.1.51.156:9669,10.1.51.157:9669,10.1.51.158:9669
postStart:
commands: |
DROP SPACE IF EXISTS rational_drug_v2;
CREATE SPACE IF NOT EXISTS rational_drug_v2(partition_num=5, replica_factor=1, vid_type=FIXED_STRING(32));
USE rational_drug_v2;
CREATE TAG commodit(spm string, tym string, gg string, sccj string);
CREATE TAG drug_classification(name string);
CREATE EDGE rel_commodit_drug_classification();
afterPeriod: 8s
preStop:
commands: |
logPath: ./err/test.log
files:
- path: ./commodit.csv
failDataPath: ./err/commodit.csv
batchSize: 2
inOrder: true
type: csv
csv:
withHeader: false
withLabel: false
delimiter: ","
schema:
type: vertex
vertex:
vid:
index: 0
type: string
tags:
- name: commodit
props:
- name: spm
type: string
index: 1
- name: tym
type: string
index: 2
- name: gg
type: string
index: 3
- name: sccj
type: string
index: 4
- path: ./drug_classification.csv
failDataPath: ./err/drug_classification.csv
batchSize: 2
inOrder: true
type: csv
csv:
withHeader: false
withLabel: false
delimiter: ","
schema:
type: vertex
vertex:
vid:
index: 0
type: string
tags:
- name: drug_classification
props:
- name: name
type: string
index: 1
- path: ./rel_commodit_drug_classification.csv
failDataPath: ./err/rel_commodit_drug_classification.csv
batchSize: 2
inOrder: true
type: csv
csv:
withHeader: false
withLabel: false
schema:
type: edge
edge:
name: rel_commodit_drug_classification
withRanking: false
srcVID:
type: string
index: 0
dstVID:
type: string
index: 1./nebula-importer --config ./rational_drug_v2.yaml
SHOW SPACES
match (c:commodit{spm:"0.9%氯化钠注射液;1000ml:9g;上海输血技术有限公司"}) return c
参考:
Nebula Importer: https://github.com/vesoft-inc/nebula-importer/tree/master Build Go environment: https://github.com/vesoft-inc/nebula-importer/blob/release-v2.0.0-ga/docs/golang-install-en.md 配置示例: https://github.com/vesoft-inc/nebula-importer/tree/master/examples/v2