我有一个奇怪的错误,因为我无法使用neo4j 3.0.6从机器A到B连接到远程shell。服务器B(ip地址192.168.10.204)托管Neo4j。 所有这些机器都运行Debian 8和neo4j 3.0.6
首先,dbms.shell.enabled=true and dbms.shell.host=0.0.0.0
(和端口)当然是在neo4j.conf中设置的
我深入研究了这个错误并得到了几个情况。
刚开始时,我在机器A中启动了shell:
Shell$ ./neo4j-shell -host 192.168.10.204 -port 1337 -v
Welcome to the Neo4j Shell! Enter 'help' for a list of commands NOTE: Remote Neo4j graph database service 'shell' at port 1337
neo4j-sh (?)$ return "1"; Connection refused to host: 127.0.1.1; nested exception is:
java.net.ConnectException: Connection refused neo4j-sh (?)$ Shell$
深入研究这个bug,我使用/ etc / hosts文件和RMI标志并尝试了不同的东西(例如通过使用127.0.1.1地址注释行)
我现在的情况:
/etc/hosts
127.0.0.1 localhost
127.0.1.1 debian-jessie.vagrantup.com debian-jessie
我在neo4j-wrapper.conf中添加的标志是:
-Djava.rmi.server.hostname=debian-jessie.vagrantup.com -Dremoting.bind_by_host=false
现在Neo4j接受启动,我可以尝试远程连接,所以我得到:
$ ./neo4j-shell -host 192.168.10.204 -port 1337 -v
ERROR (-v for expanded information):
Unknown host: debian-jessie.vagrantup.com; nested exception is:
java.net.UnknownHostException: debian-jessie.vagrantup.com
java.rmi.UnknownHostException: Unknown host: debian-jessie.vagrantup.com; nested exception is:
java.net.UnknownHostException: debian-jessie.vagrantup.com
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:616)
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:130)
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:358)
at org.neo4j.shell.StartClient.start(StartClient.java:229)
at org.neo4j.shell.StartClient.main(StartClient.java:147)
Caused by: java.net.UnknownHostException: debian-jessie.vagrantup.com
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at java.net.Socket.connect(Socket.java:538)
at java.net.Socket.<init>(Socket.java:434)
at java.net.Socket.<init>(Socket.java:211)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:40)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:148)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:613)
我测试了一个随机端口(如50587,RMI用于使用这些端口),以确定它们是否在我的linux中默认关闭,并且它们是开放的。
答案 0 :(得分:-1)
/etc/hosts
127.0.0.1 localhost
127.0.1.1 debian-jessie.vagrantup.com debian-jessie
问题出在这里。 debian-jessie.vagrantup.com
应映射到其真实IP地址,而不是127.0.0.1,而不是任何内容。否则,如果DNS系统可以提供它,则根本不应该映射它。