gremlin控制台到azure-cosmosdb 404

时间:2017-10-25 05:29:44

标签: azure azure-cosmosdb gremlin

我刚刚在Azure门户网站中创建了一个帐户,并按照说明在此处创建了我的第一个图表数据库表单:https://docs.microsoft.com/en-us/azure/cosmos-db/create-graph-gremlin-console

我从Apache Thinkerpop网站下载了Gremlin Console v3.3.0,并根据文档更新了remote-secure.yaml。但是,每次我尝试连接时,都要调用以下命令

:remote connect tinkerpop.server conf/remote-secure.yaml

Gremlin控制台返回

WARN org.apache.tinkerpop.gremlin.driver.Cluster - SSL configured without a trustCertChainFile and thus trusts all certificates without verification (not suitable for production) ERROR org.apache.tinkerpop.gremlin.driver.Handler$GremlinResponseHandler - Could not process the response io.netty.handler.codec.http.websocketx.WebSocketHandshakeException: Invalid handshake response getStatus: 404 Not Found at io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker13.verify(WebSocketClientHandshaker13.java:158) at io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker.finishHandshake(WebSocketClientHandshaker.java:210) at org.apache.tinkerpop.gremlin.driver.handler.WebSocketClientHandler.channelRead0(WebSocketClientHandler.java:73) at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:356) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:335) at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:356) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:335) at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:438) at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:312) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:286) at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:253) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:356) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:335) at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1296) at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1087) at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1122) at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:491) at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:430) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:356) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:335) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1302) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:356) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:646) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:581) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:498) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:460) at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:131) at java.lang.Thread.run(Thread.java:745) ==>Configured mygraph.graphs.azure.com/13.76.242.167:443

然后我想我可能是我的配置并从门户网站快速入门创建了一个Persons示例项目。配置看起来像这样:

hosts: [myGraph.graphs.azure.com]
port: 443
username: /dbs/graphdb/colls/Persons
password: myPrimaryKey
connectionPool: {
  enableSsl: true}
serializer: { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, config: { serializeResultToString: true }}

除了username值包含不同的dbcollection名称之外,它与我的原始配置基本相同。但是,当我在控制台中连接到远程时,它会返回相同的错误。

我认为它可能是门户网站上的防火墙,但它目前已关闭。

如果重要,我的操作系统是macOS。

2 个答案:

答案 0 :(得分:1)

将您的终端更改为xxxx.gremlin.cosmosdb.azure.com,然后尝试。

答案 1 :(得分:1)

我遇到了完全相同的问题,@Lukas的回答为我解决了这个问题。

这是我的配置文件的内容:

# Connect securely to remote Cosmos DB via Gremlin API
# Use .gremlin.cosmosdb.azure.com to avoid infinite stack trace
hosts:
  - <account-name>.gremlin.cosmosdb.azure.com
port: 443
# Find your database name and collection ID in the Azure portal
username: /dbs/<db>/colls/<coll>
# Pick read-write or read-only key
password: <key from Cosmos DB account>
connectionPool:
  enableSsl: true
  # Add cert file to avoid this error:
  # WARN  org.apache.tinkerpop.gremlin.driver.Cluster  - SSL configured without a trustCertChainFile and thus trusts all certificates without verification (not suitable for production)
  trustCertChainFile: /etc/ssl/certs/Baltimore_CyberTrust_Root.pem
serializer:
  className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0
  config:
    serializeResultToString: true

此外,我正在使用此Docker映像启动Gremlin控制台:cruftlab/gremlin-console(其中包含connectionPool.trustCertChainFile中使用的证书)。

我创建了两个文件夹:gremlin-data/{conf,data},并将配置(我上面粘贴的一个)存储在gremlin-data/conf/cosmosdb.yaml中。然后,我使用以下命令启动Gremlin控制台:

docker run --rm -it \
  -v $(pwd)/gremlin-data/conf:/opt/gremlin/conf/extra \
  -v $(pwd)/gremlin-data/data:/opt/gremlin/data \
  cruftlab/gremlin-console

现在,已加载的配置文件应该可以在映像中访问(在conf/extra下)。因此,现在您应该可以通过运行以下命令(在Gremlin控制台中)连接到Cosmos DB:

gremlin> :remote connect tinkerpop.server conf/extra/cosmosdb.yaml
==>Configured <account-name>.gremlin.cosmosdb.azure.com/<ip address>:443
gremlin>

然后就可以了!


此外,您应该能够在Cosmos DB和data卷之间进行导入/导出,但是到目前为止,我仅在本地进行了测试。 :)

积分: