Running JanusGraph inside a Docker container
For virtualization and easy access, JanusGraph provides a Docker image. Docker makes it easier to run servers and clients on a single machine without dealing with multiple installations. For instructions on installing and using Docker, please refer to the docker guide. Let's try running a simple JanusGraph instance in Docker:
8182available for us to see. The server may need a few seconds to start up so be patient and wait for the corresponding log messages to appear.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
We can now start a Gremlin Console on our local device and try to connect to the new server:
1 2 3 4 5 6 7
Conveniently, it's also possible to run both the server and the client within separate Docker containers. We therefore instantiate a container for the server:
1 2 3 4 5 6 7 8
In order to run JanusGraph, Java 8 SE is required.
Make sure the
$JAVA_HOME environment variable points to the correct location where either JRE or JDK is installed.
JanusGraph can be downloaded as a .zip archive from the Releases section of the project repository.
1 2 3 4
Once you have unzipped the downloaded archive, you are ready to go.
Running the Gremlin Console
The Gremlin Console is an interactive shell that gives you access to the data managed by JanusGraph.
You can reach it by running the
gremlin.sh script which is located in the project's
1 2 3 4 5 6 7 8 9 10
The Gremlin Console interprets commands using Apache Groovy, which is a superset of Java. Gremlin-Groovy extends Groovy by providing a set of methods for basic and advanced graph traversal funcionality. For a deeper dive into Gremlin language's features, please refer to our introduction to Gremlin.
Running the Gremlin Server
In most real-world use cases, queries to a database will not be run from the exact same server the data is stored on. Instead, there will be some sort of client-server hierarchy in which the server runs the database and handles requests while multiple clients create these requests and thereby read and write entries within the database independently of one another. This behavior can also be achieved with JanusGraph.
In order to start a server on your local machine, simply run the
gremlin-server.sh script instead of the
You can optionally pass a configuration file as a parameter.
The default configuration is located at
The default configuration (
gremlin-server.yaml) uses it's own inmemory backend instead of a dedicated database server.
No search backend is used by default, so mixed indices aren't supported as search backend isn't specified
(Make sure you are using
GraphOfTheGodsFactory.loadWithoutMixedIndex(graph, true) instead of
GraphOfTheGodsFactory.load(graph) if you follow Basic Usage example).
For further information about storage backends, visit the corresponding section of the documentation.
You are also encouraged to look into
janusgraph.sh, which by defaults starts a more sophisticated server than
Further documentation on server configuration can be found in the JanusGraph Server section. (This requires to download
janusgraph-full-0.5.2.zip instead of the default
A Gremlin server is now running on your local machine and waiting for clients to connect on the default port
To instantiate a client -- as done before -- run the
Again, a local Gremlin Console will show up.
This time, instead of using it locally, we will connect the Gremlin Console to a remote server and redirect all of it's queries to this server.
This is done by using the
The above command only establishes the connection to the server.
It does not forward the following commands to the server by default!
As a result, further commands will still be executed locally unless preceeded by
To forward every command to the remote server, use the
:remote console command.
Further documentation can be found in the TinkerPop reference docs