【问题标题】:neo4j shell -creating edges from .csvneo4j shell - 从 .csv 创建边缘
【发布时间】:2015-05-11 17:31:45
【问题描述】:

我正在使用逗号分隔值文件在 Neo4j 数据库中创建节点和边。创建节点的命令运行没有问题。创建边缘的尝试失败并出现以下错误:

线程“GC-Monitor”中的异常 java.lang.OutOfMemoryError: GC 超出开销限制

异常:java.lang.OutOfMemoryError 从 线程“GC-Monitor”中的 UncaughtExceptionHandler

此外,在命令的输出中是这样的:

neo4j-sh (?)$ using periodic commit 400 load csv with headers from 'file://localhost/tmp/vm2set3.csv' as line match (u:VM {id: line.vm_id}),(s:VNIC  {id: line.set3_id}) create (u)-[:VNIC]->(s);
SystemException: Kernel has encountered some problem, please perform neccesary action (tx recovery/restart)
neo4j-sh (?)$
SystemException: Kernel has encountered some problem, please perform neccesary action (tx recovery/restart)
neo4j-sh (?)$ using periodic commit 400 load csv with headers from 'file://localhost/tmp/unix2switch.csv' as line match (u:UNIX {id: line.intf_id}),(s:switch  {id: line.set2a_id}) create (u)-[:cable]->(s);
SystemException: Kernel has encountered some problem, please perform neccesary action (tx recovery/restart)
neo4j-sh (?)$

我的shell脚本是:

cat /home/ES2Neo/2.1/neo4j_commands.cql | /export/neo4j-community-2.1.4/bin/neo4j-shell -path /export/neo4j-community-2.1.4/data/graph.db > /tmp/na.out

命令如下:

load csv WITH HEADERS from 'file://localhost/tmp/intf.csv' AS line CREATE (:UNIX {id: line.id, MAC: line.MAC ,BIA: line.BIA ,host: line.host,name: line.name});

对于节点,和

using periodic commit 400 load csv with headers from 'file://localhost/tmp/unix2switch.csv' as line match (u:UNIX {id: line.intf_id}),(s:switch  {id: line.set2a_id}) create (u)-[:cable]->(s);

用于边缘。

csv 输入文件如下所示:

"intf_id","set2a_id"
"100321","6724919"
"125850","6717849"
"158249","6081895"
"51329","5565380"
"57248","6680663"
"235196","6094139"
"229242","4800249"
"225630","6661742"
"183281","4760022"

我做错了什么吗? Neo4j 配置中有什么我需要检查的吗?谢谢。

【问题讨论】:

  • 你解决了吗?

标签: csv neo4j


【解决方案1】:

问题是您将数据加载到数据库中的内存不足。

查看this blog post,其中详细介绍了如何成功加载 CSV 数据。

特别是,这是您应该注意的博客文章中的关键部分。

您拥有的内存越多,导入数据的速度就越快。

所以一定要编辑 conf/neo4j-wrapper.conf 并设置:

# Uncomment these lines to set specific initial and maximum
# heap size in MB.
wrapper.java.initmemory=4096
wrapper.java.maxmemory=4096

在 conf/neo4j.properties 设置中:

# Default values for the low-level graph engine
neostore.nodestore.db.mapped_memory=50M
neostore.relationshipstore.db.mapped_memory=500M
neostore.propertystore.db.mapped_memory=100M
neostore.propertystore.db.strings.mapped_memory=100M
neostore.propertystore.db.arrays.mapped_memory=0M

【讨论】:

    猜你喜欢
    • 2016-01-30
    • 1970-01-01
    • 2016-10-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多