Search code examples
gremlintinkerpop3janusgraph

How to connect to embedded inmemory Janusgraph via Gremlin Console


I have a Spring Boot Java server with an embedded in memory JanusGraph instance. While my server is running, I would like to connect to that embedded in memory JanusGraph instance via the Gremlin console for verification purposes.

Here is how I am standing up my embedded in memory JanusGraph instance:

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

I have set up a connection to an in memory gremlin-server before from my application and I can connect to that via the gremlin console, but I would prefer to have JanusGraph be embedded in my application.

I would like something like this:

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

but for an embedded inmemory Janusgraph instance.

I am really wondering if there is any way to connect to an embedded janusgraph instance via the gremlin console. Thanks!


Solution

  • This is not possible. Connecting to a remote JanusGraph instance via the gremlin console requires Gremlin Server or other Remote Gremlin Provider. Since you have embedded the JanusGraph instance in your own application without exposing a Tinkerpop compliant gremlin server/remote gremlin provider there is no way to connect remotely. The docs located at:

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

    don't directly state this fact, but it seems to be implied.

    Also check out the tinkerpop docs at:

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

    for more details about connecting to graphs.