Neo4j 2.3.2 - 无法启动数据库

时间:2016-03-19 19:51:04

标签: neo4j cypher

我的数据库中填充了大约81MB的CSV数据。

数据有一些我想要显式创建的隐式关系,所以我运行了以下命令:

with range(0,9) as numbers 
unwind numbers as n
match (ks:KbWordSequence) where ks.kbid ends with tostring(n)
match (kt:KbTextWord {kbid: ks.kbid})
create (kt)-[:SEQUENCE]->(ks)
create (ks)-[:TEXT]->(kt)

在运行代码时,我开始在.log文件中看到很多这些消息:

2016-03-19 19:27:30.740+0000 WARN  [o.n.k.i.c.MonitorGc] GC Monitor: Application threads blocked for 9149ms.

看了这些GC消息一段时间后,看到这个进程占用了6G的RAM,我杀死了windows进程并尝试再次创建关系。

当我这样做时,我收到以下错误,数据库无法启动。

Starting Neo4j failed: Component 'org.neo4j.server.database.LifecycleManagingDatabase@1dc6ce1' was successfully initialized, but failed to start. Please see attached cause exception.

.log文件中没有错误或我可以看到的任何其他相应消息。

此类错误的其他示例与Neo4j db版本不匹配相对应,在我的情况下并非如此。

我将如何从这种情况中恢复过来?

1 个答案:

答案 0 :(得分:0)

我认为事务变得太大,因为这个语句似乎触发了全局操作。首先要了解预期操作的大小:

with range(0,9) as numbers 
unwind numbers as n
match (ks:KbWordSequence) where ks.kbid ends with tostring(n)
match (kt:KbTextWord {kbid: ks.kbid})
return count(*)

根据经验,10k到100k的原子操作是一个很好的交易规模。考虑到这一点,请应用skiplimit来控制交易规模:

with range(0,9) as numbers 
unwind numbers as n
match (ks:KbWordSequence) where ks.kbid ends with tostring(n)
match (kt:KbTextWord {kbid: ks.kbid})
with ks, kt skip 0 limit 50000
create (kt)-[:SEQUENCE]->(ks)
create (ks)-[:TEXT]->(kt)
return count(*)

并运行此语句几次,直到您返回值0

根据实际使用情况,可能会有更有效的方法来防止跳过使用并直接在匹配中检测尚未处理的节点。