dingyiz's picture
Upload folder using huggingface_hub
2795186 verified

Remote Graph

About Remote Graph

Gremlin Server allows a JanusGraph instance to run on a standalone server. This enables multiple clients to connect to the same JanusGraph instance. It also allows clients to connect via non-JVM languages. By default, the Gremlin Server communicates over WebSocket.

RemoteGraphApp.java is an example Java program that connects to the Gremlin Server in two ways:

  • Gremlin Driver client. Sumbit scripts as a String for evaluation on the server.
  • Remote Graph uses the same client connection but enables you to compose queries as code.

JanusGraph configuration

JanusGraph Server configuration

  • Select a specific storage backend to use, then copy its configuration into the $JANUSGRAPH_HOME/conf/gremlin-server directory

  • Update the $JANUSGRAPH_HOME/conf/gremlin-server/gremlin-server.yaml to use the configuration file, for example:

    graphs: {
        graph: conf/gremlin-server/jgex-cql.properties
    }
    
  • Note the default $JANUSGRAPH_HOME/conf/gremlin-server/gremlin-server.yaml uses the script scripts/empty-graph.groovy to define the graph traversal source g for the graph g: graph.traversal()

JanusGraph pre-packaged distribution

Rather than installing Cassandra and Elasticsearch separately, the JanusGraph pre-packaged distribution is provided for convenience. The distribution starts a local Cassandra, Elasticsearch, and Gremlin Server.

Remote Graph configuration

Dependencies

The required Maven dependency for remote graph:

        <dependency>
            <groupId>org.apache.tinkerpop</groupId>
            <artifactId>gremlin-driver</artifactId>
            <version>${tinkerpop.version}</version>
        </dependency>

Run the example

Start the JanusGraph Server

Start the JanusGraph Server with the preferred storage configuration. The graph instance will be created if it did not previously exist. Make sure to check the server logs for errors.

$JANUSGRAPH_HOME/bin/janusgraph-server.sh $JANUSGRAPH_HOME/conf/gremlin-server/gremlin-server.yaml

Run the example application

This command can be run from the examples or the project's directory.

mvn exec:java -pl :example-remotegraph

Drop the graph

Make sure to stop the application and the Gremlin Server before dropping the graph. Follow the directions for the specific storage backend.