Spring 5 REST / GraphDB : Installing ArangoDB

Pr-requisite: http://www.sandeeprao.net/index.php/2018/05/12/spring-5-rest-graph-db-part-2-basic-spring-config-with-simple-controller/

Had used Neo4j in one of thea past projects.

However wanted to check out on ArangoDB, primary factor being Apache 2 License, Kubernetes, active community, supportive engineering team.  Following the development for couple of months now.  Time to get my hands dirty – Here it goes…

Install ArangoDB (Source : https://www.arangodb.com/download-major/debian/ )

root@server:~# curl -OL https://download.arangodb.com/arangodb33/Debian_9.0/Release.key
 % Total % Received % Xferd Average Speed Time Time Time Current
 Dload Upload Total Spent Left Speed
100 3924 100 3924 0 0 3425 0 0:00:01 0:00:01 --:--:-- 3427
root@server:~# apt-key add - < Release.key
OK
root@server:~# echo 'deb https://download.arangodb.com/arangodb33/Debian_9.0/ /' | sudo tee /etc/apt/sources.list.d/arangodb.list
deb https://download.arangodb.com/arangodb33/Debian_9.0/ /
root@server:~# sudo apt-get install apt-transport-https
Reading package lists... Done
Building dependency tree 
Reading state information... Done
The following NEW packages will be installed:
 apt-transport-https
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 171 kB of archives.
After this operation, 243 kB of additional disk space will be used.
Get:1 http://ftp.us.debian.org/debian stretch/main amd64 apt-transport-https amd64 1.4.8 [171 kB]
Fetched 171 kB in 1s (123 kB/s) 
Selecting previously unselected package apt-transport-https.
(Reading database ... 108748 files and directories currently installed.)
Preparing to unpack .../apt-transport-https_1.4.8_amd64.deb ...
Unpacking apt-transport-https (1.4.8) ...
Setting up apt-transport-https (1.4.8) ...

root@server:~# apt update
Get:1 http://security.debian.org/debian-security stretch/updates InRelease [94.3 kB]
Ign:2 http://ftp.us.debian.org/debian stretch InRelease 
Ign:3 https://download.arangodb.com/arangodb33/Debian_9.0 InRelease
Get:4 http://ftp.us.debian.org/debian stretch-updates InRelease [91.0 kB]
Get:5 http://ftp.us.debian.org/debian stretch Release [118 kB]
Get:6 https://download.arangodb.com/arangodb33/Debian_9.0 Release [1,206 B]
Get:8 https://download.arangodb.com/arangodb33/Debian_9.0 Release.gpg [819 B]
Get:9 https://download.arangodb.com/arangodb33/Debian_9.0 Packages [6,067 B]
Fetched 311 kB in 2s (105 kB/s) 
Reading package lists... Done
Building dependency tree 
Reading state information... Done
All packages are up to date.

root@server:~# apt install arangodb3=3.3.8
Reading package lists... Done
Building dependency tree 
Reading state information... Done
The following NEW packages will be installed:
 arangodb3
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 35.5 MB of archives.
After this operation, 294 MB of additional disk space will be used.
Get:1 https://download.arangodb.com/arangodb33/Debian_9.0 arangodb3 3.3.8 [35.5 MB]
Fetched 35.5 MB in 36s (961 kB/s) 
Preconfiguring packages ...
Selecting previously unselected package arangodb3.
(Reading database ... 108754 files and directories currently installed.)
Preparing to unpack .../arangodb3_3.3.8_amd64.deb ...
Unpacking arangodb3 (3.3.8) ...
Processing triggers for man-db (2.7.6.1-2) ...
Setting up arangodb3 (3.3.8) ...
2018-05-13T15:41:41Z [64277] WARNING {memory} maximum number of memory mappings per process is 65530, which seems too low. it is recommended to set it to at least 2048000
2018-05-13T15:41:41Z [64277] WARNING {memory} execute 'sudo sysctl -w "vm.max_map_count=2048000"'
2018-05-13T15:41:41Z [64277] INFO {syscall} file-descriptors (nofiles) hard limit is 1048576, soft limit is 1048576
2018-05-13T15:41:42Z [64277] INFO {startup} Server will now shutdown due to upgrade, database init or admin restoration.
Database files are up-to-date.
Created symlink /etc/systemd/system/multi-user.target.wants/arangodb3.service → /lib/systemd/system/arangodb3.service.
root@server:~#

Verify the services are started

root@server:~# systemctl status arangodb3
 arangodb3.service - ArangoDB database server
 Loaded: loaded (/lib/systemd/system/arangodb3.service; enabled; vendor preset: enabled)
 Active: active (running) since Sun 2018-05-13 21:11:48 IST; 2min 27s ago
 Process: 64477 ExecStartPre=/bin/chmod 700 /var/lib/arangodb3-apps (code=exited, status=0/SUCCESS)
 Process: 64473 ExecStartPre=/bin/chown -R arangodb:arangodb /var/lib/arangodb3-apps (code=exited, status=0/SUCCESS)
 Process: 64469 ExecStartPre=/bin/chmod 700 /var/lib/arangodb3 (code=exited, status=0/SUCCESS)
 Process: 64466 ExecStartPre=/bin/chown -R arangodb:arangodb /var/lib/arangodb3 (code=exited, status=0/SUCCESS)
 Process: 64462 ExecStartPre=/bin/chmod 700 /var/log/arangodb3 (code=exited, status=0/SUCCESS)
 Process: 64459 ExecStartPre=/bin/chown -R arangodb:arangodb /var/log/arangodb3 (code=exited, status=0/SUCCESS)
 Process: 64456 ExecStartPre=/usr/bin/install -g arangodb -o arangodb -d /var/run/arangodb3 (code=exited, status=0/SUCCESS)
 Process: 64452 ExecStartPre=/usr/bin/install -g arangodb -o arangodb -d /var/tmp/arangodb3 (code=exited, status=0/SUCCESS)
 Main PID: 64481 (arangod)
 Tasks: 70 (limit: 131072)
 CGroup: /system.slice/arangodb3.service
 └─64481 /usr/sbin/arangod --uid arangodb --gid arangodb --pid-file /var/run/arangodb3/arangod.pid --temp.path /var/tmp/arangodb3 --log.foreground-tty true

May 13 21:11:48 server arangod[64481]: 2018-05-13T15:41:48Z [64481] INFO {authentication} Jwt secret not specified, generating...
 May 13 21:11:48 server arangod[64481]: 2018-05-13T15:41:48Z [64481] INFO detected operating system: Linux version 4.16.8 (root@server) (gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1)) #1 SMP Fri May 11 21:04:11 IST 2018
 May 13 21:11:48 server arangod[64481]: 2018-05-13T15:41:48Z [64481] WARNING {memory} maximum number of memory mappings per process is 65530, which seems too low. it is recommended to set it to at least 2048000
 May 13 21:11:48 server arangod[64481]: 2018-05-13T15:41:48Z [64481] WARNING {memory} execute 'sudo sysctl -w "vm.max_map_count=2048000"'
 May 13 21:11:48 server arangod[64481]: 2018-05-13T15:41:48Z [64481] INFO using storage engine mmfiles
 May 13 21:11:48 server arangod[64481]: 2018-05-13T15:41:48Z [64481] INFO {cluster} Starting up with role SINGLE
 May 13 21:11:48 server arangod[64481]: 2018-05-13T15:41:48Z [64481] INFO {syscall} file-descriptors (nofiles) hard limit is 131072, soft limit is 131072
 May 13 21:11:48 server arangod[64481]: 2018-05-13T15:41:48Z [64481] INFO {authentication} Authentication is turned on (system only), authentication for unix sockets is turned on
 May 13 21:11:48 server arangod[64481]: 2018-05-13T15:41:48Z [64481] INFO using endpoint 'http+tcp://127.0.0.1:8529' for non-encrypted requests
 May 13 21:11:50 server arangod[64481]: 2018-05-13T15:41:50Z [64481] INFO ArangoDB (version 3.3.8 [linux]) is ready for business. Have fun!

Verify the web interface access

After logging in with the password configured while installing

 

Just a check for the empty graphs view

Proceeding adding code to create a vertex in the graph (in our case a Tenant Entry).

Update pom.xml – Add maven dependency for Arangodb Java driver.  Also we would be using Spring-data – add the necessary dependancies

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersiaon>4.0.0</modelVersion>
  <groupId>GraphDBPoC</groupId>
  <artifactId>GraphDBPoC</artifactId>
  <version>1.0</version>
  <packaging>war</packaging>
  <properties>
    <failOnMissingWebXml>false</failOnMissingWebXml>
    <java.version>1.8</java.version>
    <spring.version>5.0.6.RELEASE</spring.version>
    <servlets.version>3.1.0</servlets.version>
    <jackson.version>2.9.5</jackson.version>
    <arango.driver.version>4.2.2</arango.driver.version>
    <spring.data.version>2.0.0<spring.data.version>
  </properties>
  <dependencies>
    ...
    ...
    ...
    <dependency>
      <groupId>com.arangodb</groupId>
      <artifactId>arangodb-java-driver</artifactId>
      <version>${arango.driver.version}</version>
    </dependency>
    <dependency>
        <groupId>com.arangodb</groupId>
        <artifactId>arangodb-spring-data</artifactId>
        <version>${spring.data.version}</version>
    </dependency>
  </dependencies>
  <build>
    ...
    ...
  </build>
</project>