JanusGraph is a graph database that stores nodes and relationships instead of tables, or documents. JanusGraph is accessible using the Gremlin query language, which allows retrieving and modifying data in the graph.
This tutorial explains how to install JanusGraph inside a Docker container in the Linux. Commands have been tested on Ubuntu.
Prepare environment
Make sure you have installed Docker in your system. If you are using Ubuntu, installation instructions can be found in the post.
Install JanusGraph
Before starting, create directory for data:
sudo mkdir -p /opt/janusgraph/dataSet janusgraph user (ID: 999) as owner for newly created directory:
sudo chown -R 999:999 /opt/janusgraphNote: it doesn't matter that janusgraphjanusgraph
- Host network
Run the following command to create a container for JanusGraph that uses host network:
docker run -d --name=janusgraph --restart=always --network=host \
    -v /opt/janusgraph/data:/var/lib/janusgraph \
    janusgraph/janusgraph- User-defined bridge network
User-defined bridge network can be used for listening on different port. By default, JanusGraph service is listening on port 8182. It can be changed with -p option.
docker network create app-netdocker run -d --name=janusgraph --restart=always --network=app-net \
    -p 8080:8182 \
    -v /opt/janusgraph/data:/var/lib/janusgraph \
    janusgraph/janusgraphTesting JanusGraph
Run the following command to start a Gremlin Console:
docker exec -it janusgraph bin/gremlin.shThe command launches an interactive shell. JanusGraph uses the Gremlin Server for processing client queries. Connect to Gremlin Server using the command:
:remote connect tinkerpop.server conf/remote.yamlOutputs the following line on successful connection:
==>Configured localhost/127.0.0.1:8182Exit Gremlin Console:
:exitUninstall JanusGraph
To completely remove JanusGraph, remove its container:
docker rm --force janusgraphRemove JanusGraph image:
docker rmi janusgraph/janusgraphYou can also remove JanusGraph data:
sudo rm -rf /opt/janusgraphIf a user-defined bridge network was created, you can delete it as follows:
docker network rm app-net 
             
                         
                         
                        
Leave a Comment
Cancel reply