我是neo4j的新手,当我写这段代码时,我得到了以下错误:
>>> from py2neo import neo4j
>>> graph_DB = neo4j.GraphDatabaseService ("http://localhost:7474/db/data")
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
graph_DB = neo4j.GraphDatabaseService ("http://localhost:7474/db/data")
File "C:Python27libsite-packagespy2neoneo4j.py", line 557, in __init__
rs = self._send(rest.Request(self, "GET", self._uri))
File "C:Python27libsite-packagespy2neorest.py", line 372, in _send
raise SocketError(err)
SocketError: error(10061, 'No connection could be made because the target machine actively refused it')
我用的是windows 7。我已经做了几次搜索,发现我必须打开端口7474才能在windows防火墙中使用它,具有高级安全性,但是当我在入站规则中创建新规则时,这对该端口不起作用。同样在ubuntu 10.10中,我不能使用netcat:
打开端口nc -l 7474
我错在哪里?谢谢你
默认情况下,Neo4J将访问限制为127.0.0.1 (localhost),但是,您可以更改此选项。在"conf"文件夹中找到"neo4j-server. conf"。然后用记事本打开这个文件。
查找以下内容:
# Let the webserver only listen on the specified IP. Default is localhost (only
# accept local connections). Uncomment to allow any connection. Please see the
# security section in the neo4j manual before modifying this.
# org.neo4j.server.webserver.address=0.0.0.0
取消最后一行的注释(去掉#符号)以允许从EVERYWHERE(0.0.0.0)访问。可选地将IP设置为只允许从您的web服务器访问