Since there is a need to use graph data in recent projects, we have chosen to try using janusgraph in comparison. This small note records the process of installing janusgraph.
Janusgraph Introduction
According to the official website, Janusgraph is an extensible graph database optimized for storing and querying hundreds of millions of vertices and edges that are distributed across multi-cluster clusters. Janusgraph is a transactional database that supports thousands of concurrent users to perform complex graph traversal in real time.
Janusgraph supports multiple storage back-ends:
- Apache Cassandra?
- Apache HBase?
- Google Cloud Bigtable
- Oracle BerkeleyDB
It also supports geo-search, scope search, and full-text search, with the following search engines:
- ElasticSearch?
- Apache SOLR?
- Apache Lucene?
Janusgraph native support Apache Tinkerpop? Graph stacks, including:
- Gremlin Chart Query Language
- Gremlin Map Server
- Gremlin applications
Installation of Janusgraph
The installation of this janusgraph is based on the Ubuntu 18.04 LTS environment, primarily with Docker-mounted storage backend Cassandra and search engine ElasticSearch.
0. Docker Installation
Considering the network problem, the installation of Docker mainly refers to the introduction of Tsinghua Mirror Station: Docker Community Edition Mirror use Help.
1) Trust the GPG public key of Docker:
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
2) Add repositories:
sudo add-apt-repository "deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian $(lsb_release -cs) stable"
3) Final installation of Docker-ce
sudo apt-get update
sudo apt-get install docker-ce
4) Add current user to Docker user group, can run Docker without sudo (optional)
sudo groupadd docker
sudo usermod -aG docker $USER
5) Additional steps: Add a domestic Docker image acceleration
Edit the following in the/etc/docker/daemon.jsonfile:
{
"registry-mirrors": [
"https://registry.docker-cn.com"
]
}
1. Cassandra Installation
The installation of Cassandra is referenced to the official Docker library, which is the version of this installation3.11.3.
docker run --name cassandra-3.11.3 -p 7000:7000 -p 7001:7001 -p 7199:7199 -p 9042:9042 -p 9160:9160 -d cassandra:3.11.3
2. Elasticsearch Installation
The installation of Elasticsearch is referenced to the official Docker library, which is the version of this installation5.5.2.
docker run --name es-5.5.2 -p 9200:9200 -p 9300:9300 -d elasticsearch:5.5.2
Chinese word breaker plug-in installation (optional)
You can refer to the IK analysis for Elasticsearch GitHub introduction installation.
First into the Elasticsearch Docker environment,
docker exec -it es-5.5.2 bash
Then execute the installation command below.
./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v5.5.2/elasticsearch-analysis-ik-5.5.2.zip
After successful installation, you need to exit the current Elasticsearch Docker environment and executeexit.
Then restart Elasticsearch:
docker restart es-5.5.2
3. Installing Janusgraph
Janusgraph on its Github releases page.
Specific installation and configuration reference the official website of the introduction of the document
Download this optionjanusgraph-0.3.0-hadoop2.zip.
wget https://github.com/JanusGraph/janusgraph/releases/download/v0.3.0/janusgraph-0.3.0-hadoop2.zip
After the download is complete useunzipunzip and enter thejanusgraph~directory.
We need janusgraph to run as a service and useWebSocketcommunication.
First you need to look at the ' conf/gremlin-server/gremlin-server.yaml ' configuration file, which will be specified when the service is started. The first few lines of the file are the following:
host: 0.0.0.0
port: 8182
scriptEvaluationTimeout: 30000
channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer
graphs: {
graph: conf/gremlin-server/janusgraph-cql-es-server.properties
}
- hostandportspecifies the address and port of the service listener;
- scriptEvaluationTimeoutRefers to the maximum time of a single query, the default is30s;
- channelizerSet to useWebSocketChannelizerorHttpChannelizer;
- graphs.graphPoint to the specific configuration file for Janusgraphconf/gremlin-server/janusgraph-cql-es-server.properties.
The following arejanusgraph-cql-es-server.propertiesthe main configuration contents in
# Storage backend
storage.backend = cql
storage.hostname = 127.0.0.1
storage.cql.keyspace = janusgraph
# Cache configuration
cache.db-cache = true
cache.db-cache-clean-wait = 20
cache.db-cache-time = 180000
cache.db-cache-size = 0.25
# Search engine configuration
index.search.backend = elasticsearch
index.search.hostname = 127.0.0.1
index.search.elasticsearch.client-only = true
Once the configuration is complete, you can start itGremlin Server!
bin/gremlin-server.sh ./conf/gremlin-server/gremlin-server.yaml
After successful boot, it will be displayed on the Listening8182port:
INFO org.apache.tinkerpop.gremlin.server.GremlinServer - Channel started at port 8182.
Summary
Here, Janusgraph's installation configuration is done! If you need more detailed configuration, it is recommended to read the documentation on the official site. This little note only in the form of journal to record our installation of janusgraph process, because we are also the first contact map database and janusgraph, there may be many shortcomings and the wrong place, welcome to criticize correct.
Later on, we will further describe the process of defining schemas, building indexes, and queries in Janusgraph, as well as the pits that have been trampled.
Janusgraph Diagram Database Installation--take janusgraph 0.3.0 as an example