首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将gremlin CLI连接到远程修补程序gremlin服务器。

将gremlin CLI连接到远程修补程序gremlin服务器。
EN

Stack Overflow用户
提问于 2018-10-25 21:10:41
回答 1查看 3.2K关注 0票数 5

使用gremlin-javascript,我将使用以下方法连接到远程服务器:

代码语言: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中,我可以使用

代码语言:javascript
复制
gremlin> graph = TinkerGraph.open()
gremlin> g = graph.traversal()

然而,我想连接到我在localhost:8182的图形。这并不是真正的诀窍:

代码语言:javascript
复制
gremlin> graph = RemoteGraph.open('ws://localhost:8182/gremlin')

也不完全是这样的:

代码语言:javascript
复制
gremlin> graph = TinkerGraph.open()
gremlin> g = graph.traversal().withRemote(new DriverRemoteConnection('ws://localhost:8182/gremlin'))

如何从CLI连接到此服务器?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-10-25 21:22:29

Gremlin控制台内置了对此的支持,并详细描述了这里。基本连接命令是:

代码语言:javascript
复制
gremlin> :remote connect tinkerpop.server conf/remote.yaml
==>Configured localhost/127.0.0.1:8182

此时,您可以针对远程图发出遍历:

代码语言:javascript
复制
gremlin> :> g.V().values('name')
==>marko
==>vadas
==>lop
==>josh
==>ripple
==>peter

如果您想要删除:>语法,您可以将REPL置于“控制台”模式,并且不再需要该前缀:

代码语言:javascript
复制
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 mode
票数 12
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52998174

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档