尝试在janusgraph docker中创建图形时连接被拒绝

tzcvj98z  于 2021-06-14  发布在  Cassandra
关注(0)|答案(1)|浏览(668)

我用的是janusgraph docker的图片(https://github.com/janusgraph/janusgraph-docker)在docker设置janusgraph。当我在没有docker的情况下使用janusgraph时,一切都很好,但现在我遇到了一些问题:
我使用以下命令设置了带有cassandra+elasticsearch的janusgraph:

docker-compose -f docker-compose-cql-es.yml up

这将启动所有必需的容器,我对此进行了双重检查:

docker ps

现在我想通过gremlin控制台连接到janusgraph,使用:

docker-compose -f docker-compose-cql-es.yml run --rm -e GREMLIN_REMOTE_HOSTS=janusgraph janusgraph ./bin/gremlin.sh

这将启动gremlin控制台,我将远程配置为:

:remote connect tinkerpop.server conf/remote.yaml
:remote console

效果也不错。之后,我尝试创建一个新图形,但失败的原因是:

graph = JanusGraphFactory.open('conf/janusgraph-cassandra-es.properties')

这给了我以下信息:
连接被拒绝(连接被拒绝)
完整堆栈跟踪:
java.net.connectexception:java.net.plainsocketimpl.socketconnect(本机方法)的java.net.abstractplainsocketimpl.doconnect(abstractplainsocketimpl)的连接被拒绝(连接被拒绝)。java:350)在java.net.abstractplainsocketimpl.connecttoaddress(abstractplainsocketimpl。java:206)在java.net.abstractplainsocketimpl.connect(abstractplainsocketimpl。java:188)在java.net.socksocketimpl.connect(socksocketimpl。java:392)在java.net.socket.connect(socket。java:589)在org.apache.thrift.transport.tsocket.open(tsocket。java:182)在org.apache.thrift.transport.tframedtransport.open(tframedtransport。java:81)在org.janusgraph.diskstorage.cassandra.thrift.thriftpool.ctconnectionfactory.makerawconnection(ctconnectionfactory。java:110)在org.janusgraph.diskstorage.cassandra.thrift.thriftpool.ctconnectionfactory.makeobject(ctconnectionfactory。java:74)在org.janusgraph.diskstorage.cassandra.thrift.thriftpool.ctconnectionfactory.makeobject(ctconnectionfactory。java:43)在org.apache.commons.pool.impl.generickeyedobjectpool.borrowobject(generickeyedobjectpool。java:1220)在org.janusgraph.diskstorage.cassandra.thrift.cassandrathriftstoremanager.getcassandrapartitioner(cassandrathriftstoremanager。java:215)在org.janusgraph.diskstorage.cassandra.thrift.cassandrathriftstoremanager。java:197)位于sun.reflect.nativeconstructoraccessorimpl.newinstance0(本机方法)sun.reflect.nativeconstructoraccessorimpl.newinstance(nativeconstructoraccessorimpl。java:62)在sun.reflect.delegatingconstructoraccessorimpl.newinstance(delegatingconstructoraccessorimpl。java:45)在java.lang.reflect.constructor.newinstance(constructor。java:423)在org.janusgraph.util.system.configurationutil.instantiate(configurationutil。java:58)在org.janusgraph.diskstorage.backend.getimplementationclass(backend。java:440)在org.janusgraph.diskstorage.backend.getstoragemanager(backend。java:411)在org.janusgraph.graphdb.configuration.builder.graphdatabaseconfigurationbuilder.build(graphdatabaseconfigurationbuilder。java:50)在org.janusgraph.core.janusgraphfactory.open(janusgraphfactory。java:161)在org.janusgraph.core.janusgraphfactory.open(janusgraphfactory。java:132)在org.janusgraph.core.janusgraphfactory.open(janusgraphfactory。java:79) 在org.janusgraph.core.janusgraphfactory$open.call(未知源代码)的script4.run(script4。groovy:1)位于org.apache.tinkerpop.gremlin.groovy.jsr223.gremlingroovyscriptengine.eval(gremlingroovyscriptengine)。java:674)位于org.apache.tinkerpop.gremlin.groovy.jsr223.gremlingroovyscriptengine.eval(gremlingroovyscriptengine)。java:376)在javax.script.abstractscriptengine.eval(abstractscriptengine。java:233)在org.apache.tinkerpop.gremlin.groovy.engine.gremlinexecutor.lambda$eval$0(gremlinexecutor。java:266)在java.util.concurrent.futuretask.run(futuretask。java:266)在java.util.concurrent.executors$runnableadapter.call(executors。java:511)在java.util.concurrent.futuretask.run(futuretask。java:266)位于java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor。java:1149)在java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor。java:624)在java.lang.thread.run(线程。java:748)
我可以运行如下查询,因为janusgraph服务器似乎预先部署了一个带有遍历对象的图:

g.addV('user').property('username','exampleUserName')

但是当我试图从python gremlin连接到:

graph = Graph()
g = graph.traversal().withRemote(DriverRemoteConnection('ws://0.0.0.0:8182/gremlin','g'))

我也犯了同样的错误,有什么帮助吗?

2nbm6dog

2nbm6dog1#

请注意,当服务器侦听时 0.0.0.0 ,这意味着它将可以从运行它的计算机以外的其他计算机访问。倾听的另一种选择 127.0.0.1 意味着只有在服务器运行时才能从同一主机上的进程访问它。
但是,当您的客户端连接到服务器时,它必须指定它连接到的实际主机名或ip地址,这可能是 localhost 或者 127.0.0.1 或者服务器在网络上连接的ip地址。但是,您不能使用 0.0.0.0 在客户端到服务器的连接字符串中,因为这不是要连接的有效ip地址。

相关问题