Azure CosmosDB(Gremlin API),如何使用Gremlin.Net进行连接 [英] Azure CosmosDB (Gremlin API), How to connect using Gremlin.Net

查看:101
本文介绍了Azure CosmosDB(Gremlin API),如何使用Gremlin.Net进行连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用软件包 https://www.nuget.org/packages/Gremlin.Net

I am trying to use the Gremlin.Net NuGet package to connect to Azure CosmosDB (Gremlin API), using the Package https://www.nuget.org/packages/Gremlin.Net

在Azure门户上,我可以获得 Key (用于CosmosDB客户端的NuGet包:Microsoft.Azure.DocumentDB和Microsoft.Azure.Graphs)

On Azure Portal, I can obtain the Key (used on CosmosDB client NuGet packages: Microsoft.Azure.DocumentDB and Microsoft.Azure.Graphs)

如何获取ssl,端口,用户名密码凭据以连接到Azure CosmosDB(Gremlin API)以在Gremlin.Net NuGet程序包上使用?/p>

How can I obtain the ssl, port, username and password credentials to connect to Azure CosmosDB (Gremlin API) for use on the Gremlin.Net NuGet package?

推荐答案

由于您正在连接到gremlin服务器的公共端口,因此可以使用文档中显示的相同信息来进行连接 通过gremlin控制台此处

Since you are connecting to the public port of the gremlin server you can use the same information that they show in the docs to connect via the gremlin console here.

hosts: [your_database_server.gremlin.cosmosdb.azure.com]
port: 443
username: /dbs/your_database_account/colls/your_collection
password: your_primary_key
connectionPool: {
  enableSsl: true
}
serializer: { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, config: { serializeResultToString: true }}

我可以使用下面的线进行连接:

I was able to connect using the line below:

        var gremlinServer = new GremlinServer("XXX.graphs.azure.com", 443, true, "/dbs/your_database_account/colls/your_collection",
            "password");

如果您使用的是.NET和Cosmos,则还有一个Microsoft提供的名为Microsoft.Azure.Graphs的NuGet程序包,该程序包当前处于预览状态.

Also if you are using .NET and Cosmos there is a Microsoft provided NuGet package called Microsoft.Azure.Graphs which is currently in preview.

这篇关于Azure CosmosDB(Gremlin API),如何使用Gremlin.Net进行连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆