如果主机上有3个节点和3个边缘,如何通过neo4j-shell从localhost连接到noe4j数据库?

时间:2016-10-20 07:39:08

标签: neo4j neo4j-shell

最终目标是从一个数据库进行完整备份,因此我尝试通过shell连接到数据库并执行查询返回所有内容。这是问题所在:

/opt/data/core01/bin/neo4j-shell -path /opt/data/core01/data/databases -config /opt/data/core01/conf/neo4j.conf

NOTE: Local Neo4j graph database service at '/opt/data/core01/data/databases'
Welcome to the Neo4j Shell! Enter 'help' for a list of commands. Please note that neo4j-shell is deprecated and to be replaced by cypher-shell.
neo4j-sh (?)$ MATCH (n) RETURN n;
0 row
291 ms
neo4j-sh (?)$
ls -l /opt/data/core01/data/databases
total 144
drwx------. 2 root root   39 Oct 19 09:36 certificates
drwx------. 7 root root 4096 Oct 19 09:36 graph.db

我试图将graph.db添加到路径中,但是没有用。

/opt/data/core01/bin/neo4j-shell -path /opt/data/core01/data/databases/graph.db  -config /opt/data/core01/conf/neo4j.conf
Error starting org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory, /opt/data/core01/data/databases/graph.db

我尝试连接到特定端口上的服务器:

[root@tnv-it-lora0002 core01]# /opt/data/core01/bin/neo4j-shell -v localhost  -port 7474  -config /opt/data/core01/conf/neo4j.conf
non-JRMP server at remote endpoint

我对此非常陌生,所以我感谢任何帮助。

感谢

1 个答案:

答案 0 :(得分:1)

将这些行添加到conf文件中:

# Enable a remote shell server which Neo4j Shell clients can log in to.
dbms.shell.enabled=true
# The network interface IP the shell will listen on (use 0.0.0.0 for all 
interfaces).
dbms.shell.host=127.0.0.1
dbms.shell.host=127.0.0.1
# The port the shell will listen on, default is 1337.
dbms.shell.port=1337

/opt/data/core01/bin/neo4j-shell -v localhost -port 1337 -config /opt/data/core01/conf/neo4j.conf

从shell导出:

cat /opt/data/core01/bin/export_statment.cql | ./opt/data/core01/bin/neo4j-shell -v localhost -port 1337 -config /opt/data/core01/conf/neo4j.conf

/opt/data/core01/bin/neo4j-shell -v localhost -port 1337 -config /opt/data/core01/conf/neo4j.conf -file /opt/data/core01/bin/export.par