通过shell拒绝连接本地服务器(Neo4j 2.1.6)

时间:2015-01-08 14:16:05

标签: neo4j

跟进http://goo.gl/RSluPw

无法通过shell连接到本地服务器。

我安装了neo4j-community-2.1.6(没有任何修改),启动了服务器,然后想通过shell连接(如此处http://goo.gl/jI12RO所述)。我错过了什么?

这是我的控制台输出:

[~/bin/neo4j]
$ ls
CHANGES.txt   NOTICE.txt    bin/          lib/
LICENSE.txt   README.txt    conf/         plugins/
LICENSES.txt  UPGRADE.txt   data/         system/

[~/bin/neo4j]
$ java -version
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

[~/bin/neo4j]
$ ./bin/neo4j start
Using additional JVM arguments:  -server -XX:+DisableExplicitGC -Dorg.neo4j.server.properties=conf/neo4j-server.properties -Djava.util.logging.config.file=conf/logging.properties -Dlog4j.configuration=file:conf/log4j.properties -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:-OmitStackTraceInFastThrow
Starting Neo4j Server...WARNING: not changing user
process [5481]... waiting for server to be ready............................................................................... OK.
http://localhost:7474/ is ready.

[~/bin/neo4j]
$ neo4j-shell
ERROR (-v for expanded information):
    Exception creating connection to: 172.24.46.19; nested exception is: 
    java.net.SocketException: Host is down

 -host      Domain name or IP of host to connect to (default: localhost)
 ...

[~/bin/neo4j]
$ neo4j-shell -v
ERROR (-v for expanded information):
    Connection refused
java.rmi.ConnectException: Connection refused to host: 172.24.46.19; nested exception is: 
    java.net.ConnectException: Operation timed out
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619)
    at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216)
    at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:129)
    at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:194)
    at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:148)
    at com.sun.proxy.$Proxy1.welcome(Unknown Source)
    at org.neo4j.shell.impl.AbstractClient.sayHi(AbstractClient.java:215)
    at org.neo4j.shell.impl.RemoteClient.findRemoteServer(RemoteClient.java:63)
    at org.neo4j.shell.impl.RemoteClient.<init>(RemoteClient.java:55)
    at org.neo4j.shell.impl.RemoteClient.<init>(RemoteClient.java:43)
    at org.neo4j.shell.ShellLobby.newClient(ShellLobby.java:165)
    at org.neo4j.shell.StartClient.startRemote(StartClient.java:297)
    at org.neo4j.shell.StartClient.start(StartClient.java:175)
    at org.neo4j.shell.StartClient.main(StartClient.java:120)
Caused by: java.net.ConnectException: Operation timed out
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:579)
    at java.net.Socket.connect(Socket.java:528)
    at java.net.Socket.<init>(Socket.java:425)
    at java.net.Socket.<init>(Socket.java:208)
    at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:40)
    at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:147)
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:613)
    ... 14 more

 -host      Domain name or IP of host to connect to (default: localhost)
 -port      Port of host to connect to (default: 1337)
 ...

[~/bin/neo4j]
$ 

为什么shell尝试连接到主机172.24.46.19?关于http://goo.gl/R3iSzK的建议也无济于事。

更新1:

我在neo4j.properties中激活了远程shell:

# Enable shell server so that remote clients can connect via Neo4j shell.
remote_shell_enabled=true
# The network interface IP the shell will listen on (use 0.0.0 for all interfaces)
remote_shell_host=127.0.0.1
# The port the shell will listen on, default is 1337
remote_shell_port=1337

仍然没有成功:

$ neo4j start
Using additional JVM arguments:  -server -XX:+DisableExplicitGC -Dorg.neo4j.server.properties=conf/neo4j-server.properties -Djava.util.logging.config.file=conf/logging.properties -Dlog4j.configuration=file:conf/log4j.properties -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:-OmitStackTraceInFastThrow
Starting Neo4j Server...WARNING: not changing user
process [7104]... waiting for server to be ready............................................................................... OK.
http://localhost:7474/ is ready.
[~]
$ neo4j-shell
ERROR (-v for expanded information):
    Exception creating connection to: 172.24.46.19; nested exception is: 
    java.net.SocketException: Host is down

 ...

[~]
$ neo4j-shell -host 127.0.0.1 -port 1337
ERROR (-v for expanded information):
    Exception creating connection to: 172.24.46.19; nested exception is: 
    java.net.SocketException: Host is down

仍在尝试连接172.24.46.19。

1 个答案:

答案 0 :(得分:2)

我有类似的问题,将端口从1337更改为1338(您可以选择不同的端口号)修复它。

1. Stop neo4j server
2. Enable shell properties in neo4j.conf file
   # 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=0.0.0.0 
   # The port the shell will listen on, default is 1337.
   dbms.shell.port=1338
3. start neo4j server
4. Start shell
   root@ubuntu:/etc/neo4j# neo4j-shell -port 1338
   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.
NOTE: Remote Neo4j graph database service 'shell' at port 1338

neo4j-sh (?)$