代码之家  ›  专栏  ›  技术社区  ›  P_O

小精灵控制台到azure cosmosdb 404

  •  3
  • P_O  · 技术社区  · 7 年前

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

    我已经下载了Gremlin控制台 v3.3.0 来自Apache Thinkerpop网站,并更新了 remote-secure.yaml 根据文件。然而,每次我尝试连接时,通过调用以下命令

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

    小精灵控制台返回

    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。

    2 回复  |  直到 7 年前
        1
  •  1
  •   Lukas Knuth    6 年前

    将端点更改为 xxxx.gremlin.cosmosdb.azure.com 试试看。

        2
  •  1
  •   loket    6 年前

    我也有同样的问题 @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> :remote connect tinkerpop.server conf/extra/cosmosdb.yaml
    ==>Configured <account-name>.gremlin.cosmosdb.azure.com/<ip address>:443
    gremlin>
    

    你来了!


    还有,你 应该 能够在Cosmos DB和 data 体积,但到目前为止,我只在本地进行了测试。:)

    信用: