HugeGraph Installation Tutorial

HugeGraph Server Quick Start
1 Overview
HugeGraph-Server is the core part of HugeGraph project, including Core, Backend, API and other sub-modules.
Core module is the implementation of Tinkerpop interface. Backend module is used to manage data storage. At present, backend support includes: Memory, Cassandra, ScyllaDB and RocksDB. API module provides HTTP Server, which converts HTTP requests from Client into calls to Core.
HugeGraph-Server and HugeGraph Server will be written in a large number of documents, and other components are similar. There is no significant difference in the meanings of these two expressions, which can be distinguished as follows: HugeGraph-Server represents server-side component code, and HugeGraph Server represents service process.

2 Dependence
2.1 Installation of JDK-1.8
HugeGraph-Server is developed based on jdk-1.8. The code uses many classes and methods in jdk-1.8. Please install and configure them by yourself.
Be sure to execute the java-version command to view the jdk version before reading down

java -version

2.2 Install GCC-4.3.0(GLIBCXX_3.4.10) or later (optional)
If you use the RocksDB backend, be sure to execute the gcc --version command to view the gcc version; if you use other backends, you don't need them.

gcc --version

3 deployment
There are three ways to deploy HugeGraph-Server components:
Mode 1: One-click deployment
Mode 2: Download tar package
Mode 3: Source code compilation
This article uses Mode 2: Download HugeGraph's tar package for installation and deployment

3.1 Download tar package

# Way 1: Download using wget under the terminal (specific download address needs to be modified according to the situation)
$ wget${version}/hugegraph-${version}.tar.gz
# decompression
$ tar -zxvf hugegraph-${version}.tar.gz

# Mode 2: Browser download (specific download address needs to be modified according to the situation)
$ HugeGraph Of github Warehouse downloading HugeGraph:
# decompression
$ hugegraph-${version}.tar.gz

4 configuration:
4.1 Enter the installed HugeGraph directory and view the configuration file in conf:
In order to access HugeGraph service in foreign browsers, the following conf iguration files need to be modified:, gremlin-driver-settings.yaml,

[root@cdh1 conf]# pwd
[root@cdh1 conf]# ll
total 28
-rw-rw-r-- 1 2000 2000  177 Sep 10 17:00 gremlin-driver-settings.yaml
-rw-rw-r-- 1 2000 2000 2275 Apr 19 20:12 gremlin-server.yaml
-rw-rw-r-- 1 2000 2000  942 Sep 10 18:20
-rw-rw-r-- 1 2000 2000 1723 Apr 19 20:12 log4j2.xml
-rw-rw-r-- 1 2000 2000  209 Apr 19 20:12 remote-objects.yaml
-rw-rw-r-- 1 2000 2000  239 Apr 19 20:12 remote.yaml
-rw-rw-r-- 1 2000 2000  219 Sep 10 15:30

4.2 Modify the configuration file in conf:
(1) Modify the configuration file:
Because you also need to access HugeGraph using an extranet, you need to change the restserver entry to http://0.0.0:8080. (ip settings: allows machines in the same network segment to access, 8080 means the port number provided by your computer, according to your own needs to modify). Suggestion:, unless you access HugeGraph on your computer.

[root@cdh1 conf]# pwd

[root@cdh1 conf]# vim 

# Here's the result of vim opening:
# bind url

# graphs list with pair NAME:CONF_PATH

# authentication

(2) Modify the configuration file: gremlin-driver-settings.yaml
The port number here is changed to the port number set by rest server. URL in in the previous step.

[root@cdh1 conf]# pwd
[root@cdh1 conf]# vim 

# Here's the result of vim opening:
hosts: [localhost]
port: 8080
serializer: {
  className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0,
  config: {
    serializeResultToString: false

(2) Modify the configuration file:
Here we modify the storage mode. The first way is to represent the memory mode. Memory back-end data is stored in memory can not be persisted, do not need to initialize the back-end, which is the only back-end that does not need to initialize. Mode 2 represents rock SDB storage, which can persist data and needs to initialize the back end of storage. Specific modifications are as follows:

[root@cdh1 conf]# pwd

[root@cdh1 conf]# vim 

# Here's part of the result that vim opens: (shows only a few things we need to focus on)

#Modification 1:


#Modification 2:


4.3 Start the server (one of two choices)
(1) Mode 1: memory storage startup server:

[root@cdh1 hugegraph-0.9.2]# pwd
[root@cdh1 hugegraph-0.9.2]# bin/  # Here is the way to start memory storage

(2) Mode 2: rocksdb storage startup server:

[root@cdh1 hugegraph-0.9.2]# pwd
[root@cdh1 hugegraph-0.9.2]# bin/  # Initialize the database (only required at first startup)
[root@cdh1 hugegraph-0.9.2]# bin/  # Here is the way to start memory storage

(The parameters in the configuration file are explained in detail on the official website: Configuration document and Configuration item)

6 Access Server
5.1 Service Startup Status Check
jps view service process

$ jps
6475 HugeGraphServer

curl requests Restful API

$ echo `curl -o /dev/null -s -w %{http_code} "http://localhost:8080/graphs/hugegraph/graph/vertices"`

Returns the result 200, which means the server starts normally.

5.2 Request Server
HugeGraph Server's RESTful API includes many types of resources, typically graph, schema, gremlin, traverser, and task.
Graphs contain vertices, edges
schema contains vertexlabels, propertykeys, edgelabels, indexlabels
Gremlin contains various Gremlin statements, such as g.v(), which can be executed synchronously or asynchronously.
traverser contains a variety of advanced queries, including shortest path, intersection, N-step reachable neighbors, etc.
task contains queries and deletions for asynchronous tasks
5.2.1 Get the vertex of the hugegraph and its related attributes

$ curl http://localhost:8080/graphs/hugegraph/graph/vertices

Because there are many points and edges in the graph, for list-type requests, such as getting all vertices, getting all edges, etc., Server will compress and return the data, so when curl is used, a pile of scrambled code can be obtained, which can be redirected to gunzip for decompression. It is recommended to use Chrome Browser + Restlet plug-in to send HTTP requests for testing.

 curl "http://localhost:8080/graphs/hugegraph/graph/vertices" | gunzip

Currently, the default configuration of HugeGraph Server can only be accessed locally, and the configuration can be modified to allow it to be accessed on other machines.

$ vim conf/

# Modify the configuration file entry restserver to: restserver.url=

#  Stop Server
$ cd hugegraph-${version}
$ bin/

Note: When multiple HugeGraph Servers occur, you need to close them all, and then reopen HugeGraph Server, otherwise an exception may occur: (linux system kill s processes with the same class name)

# kill processes with the same class name: HugeGraph Server
$ jps | grep "HugeGraphServer" | awk '{print $1}' | xargs kill

end: The entire HugeGraph environment has been installed. If you need browser access, you need to install HugeGraph-Studio. For installation details, please refer to my next article: HugeGraph-Studio Installation Tutorial

Reference course:
HugeGraph Chinese official website
Preparing to execute Gremlin's graphical environment

Tags: REST vim curl JDK

Posted on Wed, 11 Sep 2019 01:22:18 -0700 by brendan2b