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

Database

NoSQL is not a relational database.


A relational database (RDBMS) stores a data in tabular form and that tables will have a primary key identifier. This is the predefined schema and MySQL, Oracle, PostgreSQL, Microsoft SQL Servers are examples of relational databases.


A non-relational database is a dynamic schema for unstructured data. Data can be stored in multiple collections and nodes. It is designed for distributed data stores where large scale of data storing needs. The evolution of NoSQL databases will handle huge amount of data easily. MongoDB, Redis, Cassandra are some of non-relational databases.


NoSQL is open-source, cheaper, faster and it offers for developing modern applications like Facebook, Google mail, LinkedIn. NoSQL is easily scalable, less expensive, lesser server cost, no fixed model, support integrated caching.


There are 4 basic types


Key-Value Store

It is a simple database which stores data without schema structure. Redis, Amazon S3, Amazon dynamo database are best examples of key-value store database.


Document databases

Some real-time applications are using document databases. MongoDB is one of the example of document database and it can handle any kind of data, structure and format. It provides some structure and encoding. Some encodings are JSON,XML,BJSON.


MongoDB is used for Aadhar and eBay applications. In Aadhar application, it is used to store images.


Column based databases

Datas are stored in column and that columns are grouped.


The benefits of storing datas in column enables fast search, fast access and data aggregation and also very efficient at data compression and partitioning. It provides high scalability.


Example: Cassandra


Graph Databases

Graph Databases are widely using social networking applications as it is perfect to address scalability. Data transfer from one model into another can be easy.


NoSQL follows CAP Theorem. That is ,


Consistency – Database remains consistent after execution of operation 
Availability – System is always on, there is no downtime Partition
Tolerance – No function break

A both SQL and NoSQL having their own places and being integrated into each other. NoSQL is best solution for rapid development, cloud-based storage and storing large volume of data.

0