如何通过 Gremlin 控制台连接到嵌入式内存 Janusgraph

How to connect to embedded inmemory Janusgraph via Gremlin Console

我有一个 Spring Boot Java 服务器,其中嵌入了内存中的 JanusGraph 实例。虽然我的服务器是 运行,但我想通过 Gremlin 控制台连接到嵌入在内存中的 JanusGraph 实例以进行验证。

下面是我如何建立我的嵌入式内存 JanusGraph 实例:

@Bean
public JanusGraph janusGraph() {
  JanusGraphFactory.Builder builder = JanusGraphFactory.build()
    .set("storage.backend", "inmemory")
  return builder.open();
}

我之前已经从我的应用程序建立了到内存中 gremlin-server 的连接,我可以通过 gremlin 控制台连接到它,但我更愿意将 JanusGraph 嵌入到我的应用程序中。

我想要这样的东西:

:remote connect tinkerpop.server conf/remote.yaml session-managed

但是对于嵌入式内存中的 Janusgraph 实例。

我真的很想知道是否有任何方法可以通过 gremlin 控制台连接到嵌入式 janusgraph 实例。谢谢!

这是不可能的。通过 gremlin 控制台连接到远程 JanusGraph 实例需要 Gremlin Server 或其他远程 Gremlin Provider。由于您已将 JanusGraph 实例嵌入到您自己的应用程序中,而没有公开符合 Tinkerpop 的 gremlin server/remote gremlin 提供程序,因此无法远程连接。文档位于:

https://docs.janusgraph.org/basics/deployment/#embedded-janusgraph

不要直接说明这个事实,但似乎是暗示的。

另请查看 tinkerpop 文档,网址为:

http://tinkerpop.apache.org/docs/current/reference/#connecting-gremlin

有关连接到图形的更多详细信息。