[英]How to remotely access an neo4j community container running on azure with python(neo4j module)?
There is a neo4j community version container running on the azure, and i was provided by the dns azure上面运行着一个neo4j社区版容器,我是dns提供的
http://[remote-address]:7687
http://[远程地址]:7687
if i do curl with proxy(px from github)(office recommended also), i able to get, bolt_routing, transaction, bolt_direct, neo4j_version, neo4j_edition all successfully,如果我使用代理执行 curl(来自 github 的 px)(办公室也推荐),我能够成功获得 bolt_routing、transaction、bolt_direct、neo4j_version、neo4j_edition,
And with 7474 port with web browser i also able to connect to the db and same with neo4j desktop by adding remote db.使用 7474 端口和 web 浏览器,我也可以通过添加远程数据库连接到数据库和 neo4j 桌面。
but when i do with python neo4j driver, Cannot resolve address [remote-address]:7687但是当我使用 python neo4j 驱动程序时,无法解析地址 [remote-address]:7687
import neo4j,sys
link = "bolt://" + sys.argv[1]
print(f"Trying to connect to: {link}")
def exp():
try:
x = neo4j.GraphDatabase.driver(link, auth=("neo4j", "my_pswd"))
print(x.verify_connectivity())
except Exception as e:
print(e)
so, how to connect to a container hosted on azure?那么,如何连接到托管在 azure 上的容器呢?
Update:更新:
i tried to connect with IP of the azure instance running, but我尝试连接正在运行的 azure 实例的 IP,但是
Couldn't connect to [IP-address]:7687 (resolved to ('[IP-address]:7687',)):
无法连接到 [IP-address]:7687(解析为 ('[IP-address]:7687',)):
Failed to establish connection to ResolvedIPv4Address(('[IP-address]', 7687)) (reason [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond)
Failed to establish connection to ResolvedIPv4Address(('[IP-address]', 7687)) (原因 [WinError 10060] 连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立连接失败,因为连接的主机未能回应)
it is connection through web and neo4j browser completely fine, only not through the python script.!!它通过 web 和 neo4j 浏览器连接完全正常,只是没有通过 python 脚本。!!
I would recommend neo4j Aura.我会推荐 neo4j Aura。 It is a fully managed cloud service and has a hassle free connection to a database.
它是一种完全托管的云服务,可以轻松连接到数据库。 It is also has a free tier to try.
它也有一个免费套餐可供试用。 See sample script to connect into it:
请参阅示例脚本以连接到它:
import neo4j,sys
link = "bolt://" + sys.argv[1]
print(f"Trying to connect to: {link}")
#format of uri is <9999>.databases.neo4j.io
def exp():
try:
x = neo4j.GraphDatabase.driver(link, auth=("neo4j", "my_pswd"))
print(x.verify_connectivity())
except Exception as e:
print(e)
Try尝试
link = "bolt+ssc://" + sys.argv[1]
or或者
link = "neo4j+ssc://" + sys.argv[1]
instead of代替
link = "bolt://" + sys.argv[1]
The '+ssc' variants are URI schemes for encrypted sessions that do not check certificates. '+ssc' 变体是不检查证书的加密会话的 URI 方案。 Refer to the Neo4j Driver manual for more details on the connection URI.
有关连接 URI 的更多详细信息,请参阅Neo4j 驱动程序手册。
Notes from the Neo4j migration guide来自Neo4j 迁移指南的注释
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.