【问题标题】:ClientConnectorError: Cannot connect to host <host>:8182 ssl:default [Connect call failed ('<ip-address>', 8182)]ClientConnectorError: 无法连接到主机 <host>:8182 ssl:default [Connect call failed (\'<ip-address>\', 8182)]
【发布时间】:2023-01-31 02:34:51
【问题描述】:

刚刚尝试下面提到的代码来检查我的 Amazon Neptune 服务,它抛出了这个错误:

ClientConnectorError: Cannot connect to host <host>:8182 ssl:default [Connect call failed ('<ip-address>', 8182)]
from __future__  import print_function  # Python 2/3 compatibility

from gremlin_python import statics
from gremlin_python.structure.graph import Graph
from gremlin_python.process.graph_traversal import __
from gremlin_python.process.strategies import *
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection

graph = Graph()
remoteConn = DriverRemoteConnection('wss://<host>','g')

g = graph.traversal().withRemote(remoteConn)

print(g.V().limit(2).toList())
remoteConn.close()

有人知道解决方案吗?谢谢

【问题讨论】:

    标签: gremlin amazon-neptune gremlinpython neptune-python-utils


    【解决方案1】:

    &lt;host&gt; 是一个占位符,您需要将其替换为运行 Gremlin Server 的主机的名称。如果您的 Python 客户端在同一台主机上运行,​​您可以将 &lt;host&gt; 替换为 localhost

    另请注意,如果在 Gremlin 服务器上配置了安全套接字层,则只能使用以 wss:// 开头的 url,否则使用以 ws:// 开头的 url。

    【讨论】:

    • 只是评论一下,如果发帖人使用的是 Amazon Neptune,如所标记的那样,SSL/TLS 始终处于启用状态,因此需要 wss://
    【解决方案2】:

    请记住,当您在本地连接时,您应该跳入堡垒主机,并在本地更改 Neptune DNS 以指向本地,例如。

    127.0.0.1 neptune.dns.aws.com
    

    然后当你挂在 AWS 网络上时,你可以调用 curl 命令来获取 Neptune 的响应。

    curl -X POST --data-binary 'query=select ?s ?p ?o where {?s ?p ?o} limit 10' http://neptune-dns.neptune.amazonaws.com:8182/sparql
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-07-28
      • 1970-01-01
      • 2020-09-07
      • 2019-06-15
      • 1970-01-01
      • 2021-06-02
      • 1970-01-01
      • 2021-09-29
      相关资源
      最近更新 更多