Database

ArangoDB is a NoSQL database system and supports key/value,documents,graphs data models with AQL (ArangoDB Query Language) query language.

The database uses JSON as a default storage format and it can store a nested JSON object inside a collection,although they are stored in binary format called ‘VelocyPack‘.

In NoSQL tables are called as collections and there are two type of collections,

  1. Document collection
  2. Edge collection – it have _from and _to attributes,which are used to create relations between documents.

Queries are used to filter documents based on criteria and compute new data,as well as delete and manipulate data.Indexes are used to speed up searches,there are two major indexes,

  1. Hash Indexes –  if hash index is unique,then uniqueness is violated.
  2. Geo-spatial Indexes – it supports containment and intersection queries for various geometric

A REST API is provided to interact with the database system.

ArangoDB has web interface and interactive shell.web interface called as

‘Aardvark ‘ and an interactive shell called as ‘Arangosh’


Installation steps on centos 7:

Update OS to latest stable versions,

$ sudo yum update -y

For installation go to ArangoDB installation path,

cd /etc/yum.repos.d/

on that path,

curl -OL https://download.arangodb.com/arangodb34/RPM/arangodb.repo
$ sudo yum install arangodb3-3.4.0

To start ArangoDB server:

$ sudo systemctl enable arangodb3
$ sudo systemctl start arangodb3
$ sudo systemctl status arangodb3

To verify the installation ,

$ sudo arangosh 

Endpoint IP configuration:

vi /etc/arangodb3/arangod.conf

endpoint = tcp://<ip>:8529

the default port for ArangoDB server is 8529

IP config to enable web interface:

vi /etc/arangodb3/arangosh.conf (change ip on endpoint = tcp://<ip>:8529)

$ sudo systemctl restart arangodb3

To change root password,

$ sudo systemctl stop arangodb3

ARANGODB_DEFAULT_ROOT_PASSWORD=your_password arango-secure-installation

$sudo systemctl start arangodb3

Your installed server now available on http://<ip>:8529.

ArangoSearch Views:

ArangoSearch is a new search engine feature in 3.4 version.It allows,

  1. To join documents located in different collections
  2. Filter douments
  3. Sort the result set based on criteria

ArangoSearch view creation:

In server,type the command as arangosh

To create view,

v = db._createView("ExampleView ", "arangosearch", {});

To linking with created collection and adding indexing parameter

v = db._view("ExampleView");

 

v.properties({
        links: {
          /* collection Link 0 with additional custom configuration: */
          ExampleCollection0: {
            /* examine fields of all linked collections, using default configuration: */
            includeAllFields: true,
            fields: {
              /* a field to apply custom configuration that will index English text: */
              name: {
                analyzers: ["text_en"]
              },
              /* another field to apply custom configuration that will index Chinese text: */
              text: {
                analyzers: ["text_zh"]
              }
            }
          }
        }
      });

ArangoSearch view query sample:

db._query(`FOR doc IN ExampleView
  SEARCH PHRASE(doc.text, 'Active', 'text_zh') OR STARTS_WITH(doc.b, 'ba')
  SORT TFIDF(doc) DESC
  RETURN doc`);


Reference:

https://www.arangodb.com/docs/stable/index.html

 

0