neo4j-shell 无法连接到 neo4j 服务器
neo4j-shell can not connect to neo4j Server
我正在使用 docker 版本的 neo4j (v3.1.0),我在使用 neo4j-shell.
连接到 neo4j 服务器时遇到困难
运行在 neo4r:3.1.0
docker 的一个实例之后,我 运行 一个 bash 在容器中:
$ docker exec -it neo4j /bin/bash
然后我尝试 运行 neo4j-shell
像这样:
/var/lib/neo4j/bin/neo4j-shell
但它出错了:
$ /var/lib/neo4j/bin/neo4j-shell
ERROR (-v for expanded information):
Connection refused
-host Domain name or IP of host to connect to (default: localhost)
-port Port of host to connect to (default: 1337)
-name RMI name, i.e. rmi://<host>:<port>/<name> (default: shell)
-pid Process ID to connect to
-c Command line to execute. After executing it the shell exits
-file File containing commands to execute, or '-' to read from stdin. After executing it the shell exits
-readonly Connect in readonly mode (only for connecting with -path)
-path Points to a neo4j db path so that a local server can be started there
-config Points to a config file when starting a local server
Example arguments for remote:
-port 1337
-host 192.168.1.234 -port 1337 -name shell
-host localhost -readonly
...or no arguments for default values
Example arguments for local:
-path /path/to/db
-path /path/to/db -config /path/to/neo4j.config
-path /path/to/db -readonly
我还尝试了其他主机,例如:localhost
、127.0.0.1
和 172.17.0.6
(容器 IP)。由于它不起作用,我尝试列出容器上的开放端口:
$ netstat -l
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 :::7687 :::* LISTEN
tcp 0 0 :::7473 :::* LISTEN
tcp 0 0 :::7474 :::* LISTEN
Active UNIX domain sockets (only servers)
Proto RefCnt Flags Type State I-Node Path
如您所见,没有 1337
打开!我查看了配置文件,指定端口的行被注释掉了,这意味着它应该设置为默认值 (1337)。
谁能帮我用neo4j连接到neo4j-shell?
顺便说一句,neo4j 服务器已启动 运行ning,我可以通过端口 :7474 使用它的 Web 访问。
在 3.1 中,shell 似乎默认未启用。
您需要在启用 shell 的情况下传递您自己的配置文件:
取消评论
# Enable a remote shell server which Neo4j Shell clients can log in to.
dbms.shell.enabled=true
(我发现 docker 中更改一个值的工作人员数量相当繁重,但是是的..)
或者使用新的cypher-shell:
ikwattro@graphaware-team ~> docker ps -a | grep 'neo4j'
34b3c6718504 neo4j:3.1.0 "/docker-entrypoint.s" 2 minutes ago Up 2 minutes 7473-7474/tcp, 7687/tcp compassionate_easley
2395bd0b1fe9 neo4j:3.1.0 "/docker-entrypoint.s" 5 minutes ago Exited (143) 3 minutes ago cranky_goldstine
949feacbc0f9 neo4j:3.1.0 "/docker-entrypoint.s" 5 minutes ago Exited (130) 5 minutes ago modest_boyd
c38572b078de neo4j:3.0.6-enterprise "/docker-entrypoint.s" 6 weeks ago Exited (0) 6 weeks ago fastfishpim_neo4j_1
ikwattro@graphaware-team ~> docker exec --interactive --tty compassionate_easley bin/cypher-shell
username: neo4j
password: *****
Connected to Neo4j 3.1.0 at bolt://localhost:7687 as user neo4j.
Type :help for a list of available commands or :exit to exit the shell.
Note that Cypher queries must end with a semicolon.
neo4j>
注意:Cypher-shell 支持 begin
和 commit
:
neo4j> :begin
neo4j# create (n:Node);
Added 1 nodes, Added 1 labels
neo4j# :commit;
neo4j>
-
neo4j> :begin
neo4j# create (n:Person {name:"John"});
Added 1 nodes, Set 1 properties, Added 1 labels
neo4j# :rollback
neo4j> :commit
There is no open transaction to commit
neo4j>
http://neo4j.com/docs/operations-manual/current/tools/cypher-shell/
我正在使用 docker 版本的 neo4j (v3.1.0),我在使用 neo4j-shell.
连接到 neo4j 服务器时遇到困难运行在 neo4r:3.1.0
docker 的一个实例之后,我 运行 一个 bash 在容器中:
$ docker exec -it neo4j /bin/bash
然后我尝试 运行 neo4j-shell
像这样:
/var/lib/neo4j/bin/neo4j-shell
但它出错了:
$ /var/lib/neo4j/bin/neo4j-shell
ERROR (-v for expanded information):
Connection refused
-host Domain name or IP of host to connect to (default: localhost)
-port Port of host to connect to (default: 1337)
-name RMI name, i.e. rmi://<host>:<port>/<name> (default: shell)
-pid Process ID to connect to
-c Command line to execute. After executing it the shell exits
-file File containing commands to execute, or '-' to read from stdin. After executing it the shell exits
-readonly Connect in readonly mode (only for connecting with -path)
-path Points to a neo4j db path so that a local server can be started there
-config Points to a config file when starting a local server
Example arguments for remote:
-port 1337
-host 192.168.1.234 -port 1337 -name shell
-host localhost -readonly
...or no arguments for default values
Example arguments for local:
-path /path/to/db
-path /path/to/db -config /path/to/neo4j.config
-path /path/to/db -readonly
我还尝试了其他主机,例如:localhost
、127.0.0.1
和 172.17.0.6
(容器 IP)。由于它不起作用,我尝试列出容器上的开放端口:
$ netstat -l
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 :::7687 :::* LISTEN
tcp 0 0 :::7473 :::* LISTEN
tcp 0 0 :::7474 :::* LISTEN
Active UNIX domain sockets (only servers)
Proto RefCnt Flags Type State I-Node Path
如您所见,没有 1337
打开!我查看了配置文件,指定端口的行被注释掉了,这意味着它应该设置为默认值 (1337)。
谁能帮我用neo4j连接到neo4j-shell?
顺便说一句,neo4j 服务器已启动 运行ning,我可以通过端口 :7474 使用它的 Web 访问。
在 3.1 中,shell 似乎默认未启用。
您需要在启用 shell 的情况下传递您自己的配置文件:
取消评论
# Enable a remote shell server which Neo4j Shell clients can log in to.
dbms.shell.enabled=true
(我发现 docker 中更改一个值的工作人员数量相当繁重,但是是的..)
或者使用新的cypher-shell:
ikwattro@graphaware-team ~> docker ps -a | grep 'neo4j'
34b3c6718504 neo4j:3.1.0 "/docker-entrypoint.s" 2 minutes ago Up 2 minutes 7473-7474/tcp, 7687/tcp compassionate_easley
2395bd0b1fe9 neo4j:3.1.0 "/docker-entrypoint.s" 5 minutes ago Exited (143) 3 minutes ago cranky_goldstine
949feacbc0f9 neo4j:3.1.0 "/docker-entrypoint.s" 5 minutes ago Exited (130) 5 minutes ago modest_boyd
c38572b078de neo4j:3.0.6-enterprise "/docker-entrypoint.s" 6 weeks ago Exited (0) 6 weeks ago fastfishpim_neo4j_1
ikwattro@graphaware-team ~> docker exec --interactive --tty compassionate_easley bin/cypher-shell
username: neo4j
password: *****
Connected to Neo4j 3.1.0 at bolt://localhost:7687 as user neo4j.
Type :help for a list of available commands or :exit to exit the shell.
Note that Cypher queries must end with a semicolon.
neo4j>
注意:Cypher-shell 支持 begin
和 commit
:
neo4j> :begin
neo4j# create (n:Node);
Added 1 nodes, Added 1 labels
neo4j# :commit;
neo4j>
-
neo4j> :begin
neo4j# create (n:Person {name:"John"});
Added 1 nodes, Set 1 properties, Added 1 labels
neo4j# :rollback
neo4j> :commit
There is no open transaction to commit
neo4j>
http://neo4j.com/docs/operations-manual/current/tools/cypher-shell/