How To Configure Daemon for OrientDB on CentOS 7

To Configure Daemon for OrientDB on CentOS 7

OrientDB is a free and open source NoSQL database management system. OrientDB has a multi-model NoSQL database which supports document database with a graph which is a java based application and can be run on any operating system which supports multi-master replication and easy horizontal scaling. OrientDB comes with an integrated web-based graphical user interface to easily manage the database through a web browser. It supports ACID transactions as well as atomic operations and easily returns complete graph with interconnected documents. Its query language is built on SQL and it supports three different indexing algorithms for faster performance.

It is so simple to configure daemon for OrientDB on CentOS 7, but before you proceed with this, make sure you have OrientDB installed on your system. We have already covered the method to install OrientDB on CentOS 7 and if you have missed it follow the below link:

How to install OrientDB on CentOS 7: https://www.linuxhelp.com/how-to-install-orientdb-on-centos-7

Configuring Daemon for OrientDB

Before you begin, make sure you create an OrientDB user by making use of the following command.

[root@linuxhelp ~]# useradd -r orientdb -s /bin/false 

Change ownership for working directory of OrientDB

[root@linuxhelp ~]# chown -R orientdb:orientdb /opt/orientdb

Open a file orientdb.sh and edit the following

[root@linuxhelp ~]# vim /opt/orientdb/bin/orientdb.sh
.
.

Add working directory and user

ORIENTDB_DIR=" /opt/orientdb" 
ORIENTDB_USER=" orientdb" 
.
.


In start function, you need to command out the following line and add a new line instead of that.

#       su $ORIENTDB_USER -c " cd " $ORIENTDB_DIR/bin"   /usr/bin/nohup ./server.sh 1> $LOG_DIR/orientdb.log 2> $LOG_DIR/orientdb.err & " 
.
.

And, add the following line in place of it.

su $ORIENTDB_USER sh -c " cd " $ORIENTDB_DIR/bin"   /usr/bin/nohup ./server.sh 1> ../log/orientdb.log 2> ../log/orientdb.err & " 

Again in stop function, you need to command out the following line

#       su $ORIENTDB_USER -c " cd " $ORIENTDB_DIR/bin"   /usr/bin/nohup ./shutdown.sh 1> > $LOG_DIR/orientdb.log 2> > $LOG_DIR/orientdb.err & " 

And, add the following line in place of it.

su $ORIENTDB_USER sh -c " cd " $ORIENTDB_DIR/bin"   /usr/bin/nohup ./shutdown.sh 1> > ../log/orientdb.log 2> > ../log/orientdb.err & "  .


Now, create a new file(orientdb.service) in systemd location for daemon configuration.

[root@linuxhelp ~]# vim /etc/systemd/system/orientdb.service

And in that file, you need to add the following lines.

[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

Once it is done, reload the daemon by making use of the following command.

[root@linuxhelp ~]# systemctl daemon-reload

Start OrientdB service now.

[root@linuxhelp ~]# systemctl start orientdb

If you want to check the status of OrientDB service, run the following command.

[root@linuxhelp ~]# systemctl status orientdb
● orientdb.service - OrientDB service
   Loaded: loaded (/etc/systemd/system/orientdb.service  disabled  vendor preset: disabled)
   Active: active (running) since Tue 2018-02-20 16:51:11 IST  24min ago
 Main PID: 15324 (java)
   CGroup: /system.slice/orientdb.service
           └─15324 /bin/java -d64 -server -Xms2G -Xmx2G -Djna.nosys=true -XX:...

Feb 20 16:51:12 linuxhelp.com orientdb[15324]: 2018-02-20 16:51:12:922 INFO ...]
Feb 20 16:51:12 linuxhelp.com orientdb[15324]: 2018-02-20 16:51:12:929 INFO ...]
Feb 20 16:51:12 linuxhelp.com orientdb[15324]: 2018-02-20 16:51:12:938 INFO ...]
Feb 20 16:51:12 linuxhelp.com orientdb[15324]: 2018-02-20 16:51:12:945 INFO ...]
Feb 20 16:51:12 linuxhelp.com orientdb[15324]: 2018-02-20 16:51:12:946 INFO ...]
Feb 20 16:51:12 linuxhelp.com orientdb[15324]: 2018-02-20 16:51:12:947 INFO ...]
Feb 20 16:51:12 linuxhelp.com orientdb[15324]: 2018-02-20 16:51:12:973 INFO ...]
Feb 20 16:51:12 linuxhelp.com orientdb[15324]: 2018-02-20 16:51:12:974 INFO ...]
Feb 20 16:51:12 linuxhelp.com orientdb[15324]: 2018-02-20 16:51:12:977 WARNI...]
Feb 20 16:51:12 linuxhelp.com orientdb[15324]: 2018-02-20 16:51:12:981 INFO ...]


To open a GUI, open browser and give URL as http://localhost:2480. The login page appears. Give your username and password, then click connect,

You can see that the console is now open.

With this, the method to configure daemon for OrientDB on CentOS 7 comes to an end.

FAQ
Q
What are the commands used to backup in Orientdb?
A
By using this command you can run the backup script

./backup.sh []
Q
It is possible to connect multiple databases?
A
You can connect but not at the same time.
Q
Can I configure with out stopping the service?
A
That is not recommended. For efficient configuration you have to stop the service
Q
Do you have a alternate editor?
A
You can make use of Vim editor
Q
How to use the Stack Overflow on saving objects?
A
This could be due to the high deep of the graph, usually when you create many records. To fix it save the records more often.