Neo4j无法连接到图形数据库服务器 [英] Neo4j unable to connect to graph database server

查看:793
本文介绍了Neo4j无法连接到图形数据库服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用示例脚本连接到neo4j服务器,然后运行查询.但我收到此错误:

I am using an example script to connect to the neo4j server and after that run a query. But I am getting this error:

C:\ cygwin \ lib \ python2.7 \ site-packages \ neo4j \ v1 \ session.py:94: UserWarning:TLS上的Bolt仅在Python 2.7.9+和更高版本中可用 Python 3.3+,因此通讯不安全

C:\cygwin\lib\python2.7\site-packages\neo4j\v1\session.py:94: UserWarning: Bolt over TLS is only available in Python 2.7.9+ and Python 3.3+ so communications are not secure

warn(通过TLS的螺栓仅在Python 2.7.9+和Python中可用 3.3+"

warn("Bolt over TLS is only available in Python 2.7.9+ and Python 3.3+ "

回溯(最近通话最近):文件 "C:\ Users \ FTS.fts-gnosis \ workspace \ hello1 \ tester.py",第3行,在 session = driver.session()文件"C:\ cygwin \ lib \ python2.7 \ site-packages \ neo4j \ v1 \ session.py",第148行, 会话中 会话=会话(自己)文件"C:\ cygwin \ lib \ python2.7 \ site-packages \ neo4j \ v1 \ session.py",第461行, 在初始化中 self.connection = connect(driver.host,driver.port,driver.ssl_context,** driver.config)文件 "C:\ cygwin \ lib \ python2.7 \ site-packages \ neo4j \ v1 \ connection.py",行 384,在连接中 s = create_connection((host,port))文件"C:\ Python27 \ lib \ socket.py",行553,在create_connection中 用于getaddrinfo中的res(主机,端口,0,SOCK_STREAM):

Traceback (most recent call last): File "C:\Users\FTS.fts-gnosis\workspace\hello1\tester.py", line 3, in session = driver.session() File "C:\cygwin\lib\python2.7\site-packages\neo4j\v1\session.py", line 148, in session session = Session(self) File "C:\cygwin\lib\python2.7\site-packages\neo4j\v1\session.py", line 461, in init self.connection = connect(driver.host, driver.port, driver.ssl_context, **driver.config) File "C:\cygwin\lib\python2.7\site-packages\neo4j\v1\connection.py", line 384, in connect s = create_connection((host, port)) File "C:\Python27\lib\socket.py", line 553, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM):

socket.gaierror:[Errno 11004] getaddrinfo失败

socket.gaierror: [Errno 11004] getaddrinfo failed

示例代码:

from neo4j.v1 import GraphDatabase, basic_auth
driver = GraphDatabase.driver("bolt://http://localhost:7474",             auth=basic_auth("neo4j", "neo"))
session = driver.session()
result = session.run("MATCH (label:OFFICER)-[r]->()  WHERE label.NAME = 'Prinza Limited' RETURN label,r")
print result
session.close()

推荐答案

该驱动程序仅支持Bolt,因此无法使用http.

The driver only support Bolt, so no http possible.

您的连接uri混合了两个协议,请更改为:

Your connection uri mixes the two protocols, change to this :

driver = GraphDatabase.driver("bolt://localhost",auth=basic_auth("neo4j", "neo"))
session = driver.session()

通常,仅按照存储库自述文件中的示例进行操作,就不应在连接uri中使用http: https://github.com/neo4j/neo4j-python-driver#example-usage

Normally, by just following the example in the repository readme, you shouldn't have the http in the connection uri : https://github.com/neo4j/neo4j-python-driver#example-usage

这篇关于Neo4j无法连接到图形数据库服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆