OrientDB: How To Install the NoSQL DataBase on CentOS 7

OrientDB NoSQL DBMS

Introduction – NoSQL and OrientDB

When talking about databases, in general, we refer to two major families: RDBMS (Relational Database Management System), which use as user and application program interface a language named Structured Query Language (or SQL) and non-relational database management systems, or NoSQL databases. OrientDB is part of the second family.

Between the two models there is a huge difference in the way they consider (and store) data.

Relational Database Management Systems

In the relational model (like MySQL, or its fork, MariaDB), a database is a set of tables, each containing one or more data categories organized in columns. Each row of the DB contains a unique instance of data for categories defined by columns.

Just as an example, consider a table containing customers. Each row correspond to a customer, with columns for name, address, and every required information.
Another table could contain an order, with product, customer, date and everything else. A user of this DB can obtain a view that fits its needs, for example a report about customers that bought products in a specific range of prices.

NoSQL Database Management Systems

In the NoSQL (or Not only SQL) database management systems, databases are designed implementing different “formats” for data, like a document, key-value, graph and others. The database systems realized with this paradigm are built especially for large-scale database clusters, and huge web applications. Today, NoSQL databases are used by major companies like Google and Amazon.

Document databases

Document databases store data in document format. The usage of this kind of DBs is usually raised with JavaScript and JSON, however, XML and other formats are accepted. An example is MongoDB.

Key-value databases

This is a simple model pairing a unique key with a value. These systems are performant and highly scalable for caching. Examples include BerkeleyDB and MemcacheDB.

Graph databases

As the name predicts, these databases store data using graph models, meaning that data is organized as nodes and interconnections between them. This is a flexible model which can evolve over time and use. These systems are applied where there is the necessity of mapping relationships.
Examples are IBM Graphs and Neo4j and OrientDB.

OrientDB

OrientDB, as stated by the company behind it, is a multi-model NoSQL Database Management System that “combines the power of graphs with documents, key/value, reactive, object-oriented and geospatial models into one scalable, high-performance operational database“.

OrientDB has also support for SQL, with extensions to manipulate trees and graphs.

Prerequisites

  • One server running CentOS 7
  • OpenJDK or Oracle Java installed on the server

Goals

This tutorial explains how to install and configure OrientDB Community on a server powered by CentOS 7.

OrientDB Installation

Step 1 – Create a New User

First of all, create a new user to run OrientDB. Doing this will let to run the database on an “isolated environment”. To create a new user, execute the following command:

# adduser orientdb -d /opt/orientdb

Step 2 – Download OrientDB Binary Archive

At this point, download the OrientDB archive in the /opt/orientdb directory:

# wget https://orientdb.com/download.php?file=orientdb-community-importers-2.2.29.tar.gz -O /opt/orientdb/orientdb.tar.gz

Note: at the time we write, 2.2.29 is the latest stable version.

Step 3 – Install OrientDB

Extract the downloaded archive:

# cd /opt/orientdb
# tar -xf orientdb.tar.gz

tar will extract the files in a directory named orientdb-community-importers-2.2.29. Move everything in /opt/orientdb:

# mv orientdb-community*/* .

Make the orientdb user the owner of the extracted files:

# chown -R orientdb:orientdb /opt/orientdb

Start OrientDB Server

Starting the OrientDB server requires the execution of the shell script contained in orientdb/bin/:

# /opt/orientdb/bin/server.sh

During the first start, this installer will display some information and will ask for an OrientDB root password:

+---------------------------------------------------------------+
| WARNING: FIRST RUN CONFIGURATION |
+---------------------------------------------------------------+
| This is the first time the server is running. Please type a |
| password of your choice for the 'root' user or leave it blank |
| to auto-generate it. |
| |
| To avoid this message set the environment variable or JVM |
| setting ORIENTDB_ROOT_PASSWORD to the root password to use. |
+---------------------------------------------------------------+

Root password [BLANK=auto generate it]: ********
Please confirm the root password: ********

To stop OrientDB, hit Ctrl+C.

Create a systemd Service for OrientDB

Create a new ststemd service to easily manage OrientDB start and stop. With a text editor, create a new file:

# $EDITOR /etc/systemd/system/orientdb.service

In this file, paste the following content:

[Unit]
Description=OrientDB service
After=network.target

[Service]
Type=simple
ExecStart=/opt/orientdb/bin/server.sh
User=orientdb
Group=orientdb
Restart=always
RestartSec=9
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=orientdb

[Install]
WantedBy=multi-user.target

Save the file and exit.

Reload systemd daemon service:

# systemctl daemon-reload

At this point, start OrientDB with the following command:

# systemctl start orientdb

Enable it to start at boot time:

# systemctl enable orientdb

Conclusion

In this tutorial we have seen a brief comparison between RDBMS and NoSQL DBMS. We have also installed and completed a basic configuration of OrientDB Community server-side.

This is the first step for deploying a full OrientDB infrastructure, ready for managing large-scale systems data.

LEAVE A REPLY

Please enter your comment!
Please enter your name here