我試圖在使用gremlin/java圖形模式與cosmossDB模擬器時出現問題並陷入困境。當使用gremlin連接到Azure cosmossDB仿真器時的超時連接
模擬器是所有安裝,運行和證書導入到我的Java密鑰庫(我可以連接使用文檔界面,所以我知道這工作)。
模擬器Web控制檯目前正在顯示集合而不是圖形。
我的簡單代碼(Groovy腳本)看起來像這樣
Cluster cluster
Client client
try {
def builder = Cluster.build()
builder.addContactPoint("localhost")
.port(8081)
.protocol ("https")
.keyPassword("C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==")
.enableSsl(true)
cluster = builder.create()
} catch (Exception ex) {
ex.printStackTrace()
}
client = cluster.connect()
String[] gremlinQueries = [
"g.V().drop()",
"g.addV('person').property('id', 'thomas').property('firstName', 'Thomas').property('age', 44)",
"g.addV('person').property('id', 'mary').property('firstName', 'Mary').property('lastName', 'Andersen').property('age', 39)",
"g.addV('person').property('id', 'ben').property('firstName', 'Ben').property('lastName', 'Miller')",
"g.addV('person').property('id', 'robin').property('firstName', 'Robin').property('lastName', 'Wakefield')",
"g.V('thomas').addE('knows').to(g.V('mary'))",
"g.V('thomas').addE('knows').to(g.V('ben'))",
"g.V('ben').addE('knows').to(g.V('robin'))",
"g.V('thomas').property('age', 44)",
"g.V().count()",
"g.V().hasLabel('person').has('age', gt(40))",
"g.V().hasLabel('person').order().by('firstName', decr)",
"g.V('thomas').outE('knows').inV().hasLabel('person')",
"g.V('thomas').outE('knows').inV().hasLabel('person').outE('knows').inV().hasLabel('person')",
"g.V('thomas').repeat(out()).until(has('id', 'robin')).path()",
"g.V('thomas').outE('knows').where(inV().has('id', 'mary')).drop()",
"g.E().count()",
"g.V('thomas').drop()"
]
for (gremlin in gremlinQueries) {
ResultSet results = client.submit(gremlin);
CompletableFuture<List<Result>> completableFutureResults = results.all()
List<Result> resultList = completableFutureResults.get()
for (Result result : resultList) {
println(result.toString())
}
}
建設者創造和客戶端連接 - 當我在看的調試器,但是當我嘗試客戶端提交我得到以下堆棧跟蹤。
Connected to the target VM, address: '127.0.0.1:59992', transport: 'socket'
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Caught: java.lang.RuntimeException: java.lang.RuntimeException: java.util.concurrent.TimeoutException: Timed out while waiting for an available host - check the client configuration and connectivity to the server if this message persists
Disconnected from the target VM, address: '127.0.0.1:59992', transport: 'socket'
java.lang.RuntimeException: java.lang.RuntimeException:
java.util.concurrent.TimeoutException: Timed out while waiting for an available host - check the client configuration and connectivity to the server if this message persists
at org.apache.tinkerpop.gremlin.driver.Client.submit(Client.java:214)
at org.apache.tinkerpop.gremlin.driver.Client.submit(Client.java:198)
at org.apache.tinkerpop.gremlin.driver.Client$submit.call(Unknown Source)
at playpen.TinkerPop-Example.run(TinkerPop-Example.groovy:64)
Caused by: java.lang.RuntimeException: java.util.concurrent.TimeoutException: Timed out while waiting for an available host - check the client configuration and connectivity to the server if this message persists
at org.apache.tinkerpop.gremlin.driver.Client.submitAsync(Client.java:310)
at org.apache.tinkerpop.gremlin.driver.Client.submitAsync(Client.java:242)
at org.apache.tinkerpop.gremlin.driver.Client.submit(Client.java:212)
幾個想法,我有一個「familyDB」從以前的文件數據庫原型。但不能在用戶的建造者中找到gremlin配置方法來表示這一點。
進一步,如果你想從頭開始,爲圖的頂點等創建集合的當量創建DBS名
所以有沒有人有本地cosmossDB模擬器工作圖配置,並且我做了什麼錯/錯過導致此超時。它有一些簡單但我錯過了它。附件是拍攝調試器之前,我開始issueing客戶機命令預先
感謝
PS - 試圖從git的轂配置羣集作爲每個樣品中天青圖表拉鍊。
我的配置文件看起來像這樣
hosts: [localhost] port: 8081 username: /dbs/familyDB/colls/FamilyCollection password: C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw== connectionPool: { enableSsl: true} serializer: { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, config: { serializeResultToString: true }}
而修改後的代碼來獲取連接現在讀
try {
File config = new File("D:/Intellij - Azure/quickstart-java/graph/src/main/cosmossDB-config.yaml")
assert config.exists()
Cluster.Builder builder = Cluster.build(config)
cluster = builder.create()
println cluster.dump()
} catch (FileNotFoundException e) {
e.printStackTrace()
return
}
,我已經從中返回以下
羣集實例甩了運行時的值prop: maxWaitForConnection, with value 3000 prop: nioPoolSize, with value 8 prop: keepAliveInterval, with value 1800000 prop: loadBalancingStrategy, with value class org.apache.tinkerpop.gremlin.driver.LoadBalancingStrategy$RoundRobin prop: resultIterationBatchSize, with value 64 prop: port, with value 8081 prop: serializers, with value [application/json] prop: maxInProcessPerConnection, with value 4 prop: maxWaitForSessionClose, with value 3000 prop: reconnectInterval, with value 1000 prop: workerPoolSize, with value 16 prop: minInProcessPerConnection, with value 1 prop: class, with value class org.apache.tinkerpop.gremlin.driver.Cluster prop: sslEnabled, with value true prop: maxContentLength, with value 65536 prop: serializer, with value org.ap[email protected]119020fb prop: factory, with value [email protected] prop: closing, with value false prop: channelizer, with value org.apache.tinkerpop.gremlin.driver.Channelizer$WebSocketChannelizer prop: closed, with value false
但是TimeoutExcption stil l發生。
我已經下載了gremlin控制檯,並試圖:remote connect
,但是當我運行命令我得到這個,它警告沒有及時響應。
`gremlin> :remote connect tinkerpop.server conf/remote-cosmossDB.yaml
log4j:WARN No appenders could be found for logger (io.netty.util.internal.logging.InternalLoggerFactory).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
==>Configured localhost/127.0.0.1:8081
gremlin>
gremlin> g.V()
No such property: g for class: groovysh_evaluate
Type ':help' or ':h' for help.
Display stack trace? [yN]
gremlin> :remote list
==>*0 - Gremlin Server - [localhost/127.0.0.1:8081]
gremlin> :remote console
==>All scripts will now be sent to Gremlin Server - [localhost/127.0.0.1:8081] - type ':remote console' to return to local mode
gremlin> g.V()
Host did not respond in a timely fashion - check the server status and submit again.
Type ':help' or ':h' for help.
Display stack trace? [yN]
gremlin> y
Host did not respond in a timely fashion - check the server status and submit again.
Type ':help' or ':h' for help.
`
仍然卡住,不能得到這個工作 - 任何想法從cosmossDb仿真器的工作配置的人?
如果可以幫助任何人來回答 - 試圖通過conf文件,而不是在文件中讀取'主機打開集羣:[本地主機] 端口:8081 用戶名:/ DBS/familyDB/colls/FamilyCollection 密碼:C2y6yDjf5/R + ob0N8A7Cgv30VRDJIWEHLM + 4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/JW == 連接池:{ enableSsl:真正} 串行:{類名:org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0,配置:{serializeResultToString:真正}} ' –