Gremlin with Neptune:等待可用主机时超时

Gremlin with Neptune : Timed out while waiting for an available host

我正在尝试从 Lambda 函数(在 Scala 中)创建到我的 Neptune 集群的 Gremlin 连接,如下所示:

lazy val cluster =
    Cluster
      .build()
      .addContactPoint("<my-neptune-endpoint>")
      .port(NEPTUNE_ENDPOINT_PORT)
      .keepAliveInterval(0)
      .create()
  lazy val neptuneConnection: GraphTraversalSource = traversal().withRemote(DriverRemoteConnection.using(cluster))

然而,即使是简单的查询也会失败。 neptuneConnection.V().drop().toList()

抛出的异常是:

java.lang.IllegalStateException: org.apache.tinkerpop.gremlin.process.remote.RemoteConnectionException: java.lang.RuntimeException: java.lang.RuntimeException: java.util.concurrent.TimeoutException: Timed out while waiting for an available host - check the client configuration and connectivity to the server if this message persists

此外,我尝试使用 HTTP REST 端点连接到 Neptune,并执行了相同的查询并且成功了。这似乎是 Gremlin 连接的问题。

有人知道是什么原因造成的吗?

我的 Gremlin 连接初始化的问题是它缺少以下内容:

.enableSsl(true)

我需要启用 SSL,因为 Neptune 仅适用于 https,而 Gremlin 客户端默认为非 SSL 连接。

添加这个解决了我的问题。

我认为你不应该禁用 keepAliveInterval。你应该让默认值。说明here