我刚刚在Azure门户中创建了一个帐户,并按照下面的说明创建了我的第一个图形db表单:https://learn.microsoft.com/en-us/azure/cosmos-db/create-graph-gremlin-console
我从Apache网站下载了Gremlin控制台v3.3.0,并根据文档更新了remote-secure.yaml。但是,每次我尝试连接时,都会调用以下命令
:remote connect tinkerpop.server conf/remote-secure.yamlGremlin控制台返回
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值包含不同的db和collection名称之外,它看起来基本上是一样的。但是,当我连接到控制台中的remote时,它会返回相同的错误。
我以为它可能是门户上的防火墙,但现在关闭了。
以防万一,我的操作系统是macOS。
发布于 2018-03-21 01:08:26
将端点更改为xxxx.gremlin.cosmosdb.azure.com并试一试。
发布于 2018-07-20 17:51:15
我也有同样的问题,@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控制台:巡洋舰/gremlin-控制台 (它包含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卷之间导入/导出,但是到目前为止,我只在本地测试过这一点。:)
信贷:
https://stackoverflow.com/questions/46924616
复制相似问题