从小精灵控制台去连接到一个正在运行的小精灵服务器这是相当直接的。在这种情况下,它不会关心您是使用做为TinkerPop一部分而下载的控制台,还是它是来自于杰森图下协的控制台。这是因为小精灵服务器非常有好地隐藏了后端的实现细节。我们可以连接它通过HTTP或WebSocket终端就可以处理小精灵查询。
It is fairly straightforward to connect to a running Gremlin Server from a Gremlin Console. In this
case it should not matter whether you are using the Gremlin Console that is part of the Apache
TinkerPop download or the one that comes as part of the JanusGraph download. This is because the
Gremlin Server very nicely hides the back end implementation details from us. As far as we are
concerned it is just an HTTP or WebSockets endpoint that can handle Gremlin queries.
有一个例外,笔者最近刚意识到,笔者关于不需要担心服务器一侧的实现细节。这个例外就是可能的版本不匹配。例如下载了TinkerPop,假设您使用的是最新版本的,它会有一点点超前于图存储的版本。这只是因为无论什么时候TinkerPop发布,都需要图数据库的维护者花一些时间赶上。笔者马上会给同一个这样的例子。
There is one exception, that I am currently aware of, to my statement about not needing to worry
about server side implementation details. This exception is a result of potential version
mismatches. Typically, the TinkerPop download, assuming you have the very latest, will be at least
a few minor point releases ahead of any given graph store release. This is purely because whenever
TinkerPop has a release, it takes a bit of time for the GraphDB maintainers to catch up. I will give a
concrete example of this in a moment.
在小精灵服务器中,小精灵控制台可以使用YAML文件来配置连接远程。小精灵控制台和杰森图中包含的那个版本的控制台都包含一系更的YAML文件,它们可以用或者按需编辑后使用。为了从控制台连接到我们刚配置的服务器,文件remote.yaml 可以被使用。笔者已做了一些修改,如下所示。笔者注释掉了一些序列化的行,用稍修改的内容替代了它。因为笔者前边提到的版本问题,笔者需要这么做。在撰写本书时,杰森图支持的版本是V1d0 的GyroMessageSerializer来做为通信串行化协议进行控制台和服务器之间的通信协议。 
As with Gremlin Server, YAML files can be used to configure a remote connection from the Gremlin
Console. The Gremlin Console as well as the version that comes bundled with JanusGraph includes
a set of YAML files that can be used as-is or edited as needed. In order to connect the Gremlin
Console to the Gremlin Server that we just configured, the file remote.yaml can be used. I had to
make one change, as shown below. I commented out the serializer line and replaced it with a
slightly modified version. I had to do this because of the version issues I mentioned above. At time
of writing, JanusGraph supports version V1d0 of the GyroMessageSerializer that is used as the
communication serialization protocol between the Gremlin Console and the Gremlin Server.
然而笔者的控制台预配置了更新的V3d0的串行器,控制台和服务器需要用相同的版本。如果笔者不做这个修改,控制台和服务器就不能正常通信。注意在remote.yaml 文件中,我们也要指定我们要连接的服务器主机的名称和端口。如果我们在本地运行,那么默认的主机名localhost就可以。如果您要连接到远程的服务器,主机的值需要修改以识别小精灵服务器运行的服务器的主机名或者IP地址。同样我们可以使用默主的8182端口。默认情况下,小精灵服务器会监听8182端口。您可能需要修改这个值的唯一的原因就是您使用了不同的端口连接到了小精灵服务器。
However, my Gremlin Console was pre configured with the newer version V3d0 of the serializer. It
is essential that the console and the server be using the same version. If I did not make this change,
the Gremlin Console and the Gremlin Server would not be able to correctly communicate. Note that
in remote.yaml file we also specify the name and port of the Gremlin Server host that we will be
connecting to. As we are running everything locally the default host name of localhost is fine. If you
are connecting to a remote Gremlin Server the hosts value needs to be edited to correctly identify
name or IP address of the server where the Gremlin Server is running. Also we can use the default
port of 8182. By default a Gremlin Server listens on port 8182. The only reason you would need to
change this value is if you are connecting to a Gremlin Server using a different port.

 

 

posted on 2022-05-05 08:21  bokeyuannicheng0000  阅读(47)  评论(0)    收藏  举报