如何使用gremlin-console远程创建和访问变量? [英] How can I use gremlin-console to remotely create and access variables?
问题描述
我使用gremlin-console(它是janusgraph)远程连接到gremlin服务器,但是当我创建一个变量并访问它时,它不起作用.我的最终目标是使用gremlin-console创建索引...
I remotely connect to a gremlin server using gremlin-console(which is janusgraph), but when I create a variable and access it, it doesn't work. My ultimate goal is to use gremlin-console to create index...
gremlin> :remote connect tinkerpop.server conf/remote.yaml
==>Configured localhost/127.0.0.1:8182
gremlin> :remote console
==>All scripts will now be sent to Gremlin Server -
[localhost/127.0.0.1:8182] - type ':remote console' to return to local mode
gremlin> a = "b"
==>b
gremlin> a
No such property: a for class: Script3
Type ':help' or ':h' for help.
推荐答案
您不能将此类变量用于后续请求,因为默认情况下控制台是无会话的.因此,每个请求都是在自己的事务中执行的,并且两个不同的请求之间不会共享任何状态.
You can't use variables like this for subsequent requests, because the console is by default sessionless. So every request is executed in its own transaction and no state is shared between two different requests.
不过,您只需将session
关键字附加到connect
参数,即可配置控制台以使用会话:
However you can configure the console to use a session by simply appending the session
keyword to the connect
argument:
gremlin> :remote connect tinkerpop.server conf/remote.yaml session
==>Configured localhost/127.0.0.1:8182-[15dc7030-0e5b-4b4b-a997-9d2cf519ebb2]
gremlin> :> x = 1
==>1
gremlin> :> y = 2
==>2
gremlin> :> x + y
==>3
这篇关于如何使用gremlin-console远程创建和访问变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!