neo4j-admin导入海量数据

1. ubuntu安装neo4j, 非docker方式

之所以使用非docker方式,是我们需要使用neo4j-admin方式导入csv文件,需要在关系neo4j的情况下操作,docker下操作不方便,可能我不会。

java -version
wget -O - https://debian.neo4j.org/neotechnology.gpg.key | sudo apt-key add -

echo 'deb https://debian.neo4j.org/repo stable/' | sudo tee -a /etc/apt/sources.list.d/neo4j.list

sudo apt-get update
1. To install community edition: sudo apt-get install neo4j=3.1.4
2. To install enterprise edition: sudo apt-get install neo4j-enterprise

neo4j start, restart, stop, status

配置:

#dbms.connectors.default_listen_address=0.0.0.0 and uncomment it
bolt://0.0.0.0:7687

2. 准备数据

movieId:ID,title,year:int,:LABEL
tt0133093,"The Matrix",1999,Movie
tt0234215,"The Matrix Reloaded",2003,Movie;Sequel
tt0242653,"The Matrix Revolutions",2003,Movie;Sequel

personId:ID,name,:LABEL
keanu,"Keanu Reeves",Actor
laurence,"Laurence Fishburne",Actor
carrieanne,"Carrie-Anne Moss",Actor

:START_ID,role,:END_ID,:TYPE
keanu,"Neo",tt0133093,ACTED_IN
keanu,"Neo",tt0234215,ACTED_IN
keanu,"Neo",tt0242653,ACTED_IN
laurence,"Morpheus",tt0133093,ACTED_IN
laurence,"Morpheus",tt0234215,ACTED_IN
laurence,"Morpheus",tt0242653,ACTED_IN
carrieanne,"Trinity",tt0133093,ACTED_IN
carrieanne,"Trinity",tt0234215,ACTED_IN
carrieanne,"Trinity",tt0242653,ACTED_IN
emil,"Emil",tt0133093,ACTED_IN

3. neo4j-admin的使用

rm -rf graph.db

(base) root@geng:/# dpkg -L neo4j-enterprise

(base) root@geng:/usr# ./bin/neo4j-import --into /var/lib/neo4j/data/databases/graph.db --nodes /var/lib/neo4j/import/Entity.csv 

(base) root@geng:/var/lib/neo4j# neo4j-admin import --nodes=import/movies.csv --nodes=import/actors.csv --relationships=import/roles.csv

(base) root@geng:/var/lib/neo4j# neo4j-admin import --nodes=import/Case.csv --nodes=import/Car.csv --ignore-duplicate-nodes


(base) root@geng:/var/lib/neo4j# neo4j-admin import --nodes=import/Case.csv --nodes=import/Car.csv --nodes=import/Person-carowner.csv --nodes=import/Person-linkername.csv --nodes=import/Person-ll_thirdcarlinker.csv --nodes=import/Person-reportorname.csv --ignore-duplicate-nodes --ignore-missing-nodes
 neo4j-admin import [--mode=csv] [--database=<name>]
                          [--additional-config=<config-file-path>]
                          [--report-file=<filename>]
                          [--nodes[:Label1:Label2]=<"file1,file2,...">]
                          [--relationships[:RELATIONSHIP_TYPE]=<"file1,file2,...">]
                          [--id-type=<STRING|INTEGER|ACTUAL>]
                          [--input-encoding=<character-set>]
                          [--ignore-extra-columns[=<true|false>]]
                          [--ignore-duplicate-nodes[=<true|false>]]
                          [--ignore-missing-nodes[=<true|false>]]
                          [--multiline-fields[=<true|false>]]
                          [--delimiter=<delimiter-character>]
                          [--array-delimiter=<array-delimiter-character>]
                          [--quote=<quotation-character>]
                          [--max-memory=<max-memory-that-importer-can-use>]
                          [--f=<File containing all arguments to this import>]
                          [--high-io=<true/false>]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值