Neo4j导入工具成功但结果没有显示出来

时间:2016-07-14 22:42:26

标签: neo4j

我最近开始使用导入工具来加快加载速度,到目前为止,结果很有希望,除了它们之后通过cypher没有反映在我的数据库中。

我的流程:

$ /path/to/neo4j-community-3.0.3/bin/neo4j stop
$ rm -rf /path/to/neo4j-community-3.0.3/data/
$ mkdir /path/to/neo4j-community-3.0.3/data
$ /path/to/neo4j-community-3.0.3/bin/neo4j-import --nodes:record /path/to/records.csv --into /path/to/neo4j-community-3.0.3/data

tmp.csv:

meta:ID,time:long,lat:float,lon:float
KAQP_20140420v20001_0000,1397970000,26.9387950897,-91.2847290039
KAQP_20140420v20001_0001,1397970060,26.9387989044,-91.2847595215
.... (1440 lines of the same record format) ...

调用neo4j-import工具的结果:

Neo4j version: 3.0.3
Importing the contents of these files into neo4j-community-3.0.3/data:
Nodes:
  :record
  /neo4j/tmp.csv

Available memory:
  Free machine memory: 23.65 GB
  Max heap memory : 6.87 GB

Nodes

Done in 384ms
Prepare node index
[*:7.63 MB------------------------------------------------------------------------------------]    0
Done in 34ms
Calculate dense nodes

Done in 10ms
Node --> Relationship Sparse

Done in 10ms
Relationship --> Relationship Sparse

Done in 10ms
Node counts

Done in 51ms
Relationship counts

Done in 10ms

IMPORT DONE in 2s 360ms. Imported:
  1440 nodes
  0 relationships
  5760 properties

很棒,到目前为止一切看起来都很棒。所以现在我启动neo4j:

$ /path/to/neo4j-community-3.0.3/bin/neo4j start

然后我尝试获取记录的数量:

$ /path/to/neo4j-community-3.0.3/bin/neo4j-shell -c 'MATCH (r:record) RETURN count(r) as count;'

+----------+
| count(r) |
+----------+
| 0        |
+----------+
1 row
42 ms

这很奇怪,所以我想也许标签没有注册或什么?所以我尝试了这个:

$ /path/to/neo4j-community-3.0.3/bin/neo4j-shell -c 'MATCH (r) RETURN count(r) as count;'


+----------+
| count(r) |
+----------+
| 0        |
+----------+
1 row
28 ms

这真的很奇怪。我的下一个想法可能是目录很奇怪?所以我测试了/path/to/neo4j-community-3.0.3/data

的大小

在:

$ du -sh /path/to/neo4j-community-3.0.3/data
4K

后:

$ du -sh /path/to/neo4j-community-3.0.3/data
53M

它肯定在那里!如果我错过了关键的一步,我不知道。无论如何都在想?

1 个答案:

答案 0 :(得分:2)

当您致电$NEO4J_HOME/data/databases/graph.db时,您需要指定目标neo4j-import

/path/to/neo4j-community-3.0.3/bin/neo4j-import --nodes:record /path/to/records.csv --into /path/to/neo4j-community-3.0.3/data/databases/graph.db

或在其他地方创建导入,并将$NEO4J_HOME/data/databases/graph.db的内容替换为neo4j-import

创建的数据存储区