我正在使用 neo4j (v3.1.0) 的 docker 版本,并且在使用 neo4j-shell 连接到 neo4j 服务器时遇到困难。
运行实例后neo4r:3.1.0
docker https://hub.docker.com/_/neo4j/,我在容器内运行 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
and 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-shell 连接到 neo4j 吗?
顺便说一句,neo4j 服务器已启动并正在运行,我可以通过端口 7474 使用其 Web 访问。