使用gremlin-javascript,我将使用以下方法连接到远程服务器:
const gremlin = require('gremlin')
const Graph = gremlin.structure.Graph
const DriverRemoteConnection = gremlin.driver.DriverRemoteConnection
const graph = new Graph()
const g = graph
.traversal()
.withRemote(new DriverRemoteConnection('ws://localhost:8182/gremlin'))在gremlin中,我可以使用
gremlin> graph = TinkerGraph.open()
gremlin> g = graph.traversal()然而,我想连接到我在localhost:8182的图形。这并不是真正的诀窍:
gremlin> graph = RemoteGraph.open('ws://localhost:8182/gremlin')也不完全是这样的:
gremlin> graph = TinkerGraph.open()
gremlin> g = graph.traversal().withRemote(new DriverRemoteConnection('ws://localhost:8182/gremlin'))如何从CLI连接到此服务器?
发布于 2018-10-25 21:22:29
Gremlin控制台内置了对此的支持,并详细描述了这里。基本连接命令是:
gremlin> :remote connect tinkerpop.server conf/remote.yaml
==>Configured localhost/127.0.0.1:8182此时,您可以针对远程图发出遍历:
gremlin> :> g.V().values('name')
==>marko
==>vadas
==>lop
==>josh
==>ripple
==>peter如果您想要删除:>语法,您可以将REPL置于“控制台”模式,并且不再需要该前缀:
gremlin> :remote console
==>All scripts will now be sent to Gremlin Server - [localhost/127.0.0.1:8182]-[5ff68eac-5af9-4140-b3b8-d9311f30c053] - type ':remote console' to return to local modehttps://stackoverflow.com/questions/52998174
复制相似问题