且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Azure CosmosDB(Gremlin API),如何使用Gremlin.Net进行连接

更新时间:2023-02-15 09:29:05

由于您正在连接到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.