无法使用neo4j-shell连接到远程Neo4j服务器

时间:2016-02-10 13:02:54

标签: shell neo4j connection port connection-refused

我在服务器上安装了Neo4j 2.3.2,其防火墙的端口为1337,7474,7473(使用ncat验证)。我可以远程访问基于Web的控制台,可以在本地访问shell,但我无法远程访问shell。也就是说,在运行path/to/neo4j-shell -v -host destination.example.org时,我得到了

ERROR (-v for expanded information):
        Connection refused
java.rmi.ConnectException: Connection refused to host: <server ip addres>; nested exception is: 
        java.net.ConnectException: Verbinding is geweigerd
        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:227)
        at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:179)
        at com.sun.proxy.$Proxy1.welcome(Unknown Source)
        at org.neo4j.shell.impl.AbstractClient.sayHi(AbstractClient.java:257)
        at org.neo4j.shell.impl.RemoteClient.findRemoteServer(RemoteClient.java:70)
        at org.neo4j.shell.impl.RemoteClient.<init>(RemoteClient.java:62)
        at org.neo4j.shell.impl.RemoteClient.<init>(RemoteClient.java:45)
        at org.neo4j.shell.ShellLobby.newClient(ShellLobby.java:204)
        at org.neo4j.shell.StartClient.startRemote(StartClient.java:355)
        at org.neo4j.shell.StartClient.start(StartClient.java:226)
        at org.neo4j.shell.StartClient.main(StartClient.java:145)
Caused by: java.net.ConnectException: Verbinding is geweigerd
        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

/var/lib/neo4j/conf/neo4j.properties,我有

# 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.0 for all interfaces).
remote_shell_host=0.0.0.0
# The port the shell will listen on, default is 1337.
remote_shell_port=1337

除了提到的三个外,我还需要打开其他端口吗? 是否有任何与我错过的shell有关的进一步配置?

1 个答案:

答案 0 :(得分:2)

neo4j-shell基于Java RMI。有几个资源描述了如何为RMI进行防火墙。事实上,由于RMI正在进行动态端口分配,因此它非常复杂。

通常我通过ssh连接在本地运行neo4j-shell,这也为您提供身份验证和加密 - 您只需要打开SSH端口。