简体   繁体   English

如何使用 python(neo4j 模块)远程访问运行在 azure 上的 neo4j 社区容器?

[英]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:请参阅示例脚本以连接到它:

https://neo4j.com/cloud/aura/ https://neo4j.com/cloud/aura/

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.

相关问题 Neo4j 浏览器连接 - Neo4j Browser Connection Neo4j cypher查询对应的Gremlin查询如何实现? - How to implement Gremlin query corresponding to Neo4j cypher query? 在 google vm 中哪里可以找到 neo4j 配置文件 - Where to find neo4j config files in google vm 需要帮助并想知道我们如何将这种类型的 Neo4j Cypher 查询写入 Gremlin 查询? - Need help and Want to know how we can write this type of Neo4j Cypher query into Gremlin query? neo4j 使用 Load CSV 从 Google Cloud Storage 读取数据 - neo4j use Load CSV to read data from Google Cloud Storage 无法通过浏览器连接到 Neo4j 中的螺栓(部署在 AWS EC2 上) - Not able to connect to bolt in Neo4j through browser (deployed on AWS EC2) AWS 上的 neo4j auradb enterprise 是否有任何低成本选项可用? - Is there any low cost option available for neo4j auradb enterprise on AWS? 在 Azure 容器实例上运行 Superset - Running Superset on Azure container Instance 如何让 MSAL4J 和 azure-security-keyvault-* 协同工作? - How can I make MSAL4J and azure-security-keyvault-* work together? 如何登录Azure中的容器? - How to log into container in Azure?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM