How to install RethinkDB in Rocky Linux/Alma Linux/Centos 8

RethinkDBĀ is a free and open-source, distributed document-oriented database originally created by the company of the same name.Ā  It is a free and open-source NoSQL database system that makes it easier for building realtime apps. It comes with a graphical user interface that can be accessible from the web browser and used to manage the database. It uses JSON to load the applications into and read the database. RethinkDB is built to store JSON documents and you can scale it to multiple machines easily. It is easy to set up and has a simple query language that supports table joins and group by.

In this guide we are going to install and configure RethinkDB in Rocky Linux 8 but this guide should work fine for RHEL 8 based servers.

Prerequisites

To follow along ensure that you have:

  • An updated RHEL 8 based server like rocky linux
  • Root access in the server
  • Access to the internet

Table of content

  1. Updating the server
  2. Installing rethinkdb
  3. Starting and enabling RethinkDB service
  4. Access RethinkDB Web Interface

1. Ensuring that the server is updated

Before proceeding, let us ensure that the server has updated packages. Use this command to achieve that

sudo dnf update -y

2. Installing RethinkDB

To install the server, first add theĀ RethinkDB yum repositoryĀ to your list of repositories

sudo cat << EOF > /etc/yum.repos.d/rethinkdb.repo
[rethinkdb]
name=RethinkDB
enabled=1
baseurl=https://download.rethinkdb.com/repository/centos/8/x86_64/
gpgkey=https://download.rethinkdb.com/repository/raw/pubkey.gpg
gpgcheck=1
EOF

Then install rethinkdb

sudo dnf install rethinkdb

Confirm

$ rpm -qi rethinkdb
Name        : rethinkdb
Version     : 2.4.1
Release     : 30488
Architecture: x86_64
Install Date: Fri 26 Nov 2021 07:57:56 PM EAT
Group       : Database
Size        : 49964301
License     : ASL 2.0
Signature   : RSA/SHA256, Thu 13 Aug 2020 05:44:38 PM EAT, Key ID 1d85e93f801bb43f
Source RPM  : rethinkdb-2.4.1-30488.src.rpm
Build Date  : Thu 13 Aug 2020 12:55:09 PM EAT
Build Host  : e362cf62cbb6
Relocations : /
Packager    : RethinkDB <devops@rethinkdb.com>
Vendor      : RethinkDB
URL         : http://www.rethinkdb.com/
Summary     : RethinkDB is built to store JSON documents, and scale to multiple servers with very little effort. It has a pleasant query language that supports really useful queries like table joins and group by.
Description :
RethinkDB is built to store JSON documents, and scale to multiple servers with very little effort. It has a pleasant query language that supports really useful queries like table joins and group by.

3. Starting and enabling the service

With the service installed, start it using the

rethinkdb command like in this output:

$ rethinkdb
Recursively removing directory /home/rocky/rethinkdb_data/tmp
Initializing directory /home/rocky/rethinkdb_data
Running rethinkdb 2.4.1 (CLANG 9.0.1 (Red Hat 9.0.1-2.module_el8.2.0+309+0c7b6b03))...
Running on Linux 4.18.0-305.3.1.el8_4.x86_64 x86_64
Loading data from directory /home/rocky/rethinkdb_data
Listening for intracluster connections on port 29015
Listening for client driver connections on port 28015
Listening for administrative HTTP connections on port 8080
Listening on cluster addresses: 127.0.0.1, ::1
Listening on driver addresses: 127.0.0.1, ::1
Listening on http addresses: 127.0.0.1, ::1
To fully expose RethinkDB on the network, bind to all addresses by running rethinkdb with the `--bind all` command line option.
Server ready, "dbsrv_citizix_com_622" a1f7dd00-aee1-4648-9641-2cb722aa0854

Startup with systemd

RethinkDB still donā€™t have full support for systemd but it is plannedā€”you can track progress onĀ issue 2014.Ā 

For now, youā€™ll have to create a couple configuration files manually.

Create the fileĀ /usr/lib/tmpfiles.d/rethinkdb.confĀ with the content:

d /run/rethinkdb 0755 rethinkdb rethinkdb -

And create the service file,Ā /usr/lib/systemd/system/rethinkdb@.service:

[Unit]
Description=RethinkDB database server for instance '%i'

[Service]
User=rethinkdb
Group=rethinkdb
ExecStart=/usr/bin/rethinkdb serve --config-file /etc/rethinkdb/instances.d/%i.conf
KillMode=process
PrivateTmp=true

[Install]
WantedBy=multi-user.target

TheĀ chmodĀ for the two files should be 644 (chmod 644 <file>).

sudo chmod 644 /usr/lib/tmpfiles.d/rethinkdb.conf
sudo chmod 644 /usr/lib/systemd/system/rethinkdb@.service

Starting RethinkDB instances

First, create the RethinkDB data directory with the following command and set the ownership to theĀ rethinkdbĀ user:

rethinkdb create -d /var/lib/rethinkdb/data
sudo chown -R rethinkdb.rethinkdb <meta charset="utf-8">/var/lib/rethinkdb/data

Then, copy the sample configuration file and use theĀ configuration fileĀ documentation as a guide to customize it. (If you donā€™t have the sampleĀ .confĀ file, you can download itĀ here.)

sudo cp /etc/rethinkdb/default.conf.sample /etc/rethinkdb/instances.d/instance1.conf

sudo vim /etc/rethinkdb/instances.d/instance1.conf

While you may be able to leave many options at their defaults, youā€™ll definitely need to change theĀ directory=Ā line in the configuration file to point to your RethinkDB data directory.

directory=<meta charset="utf-8">/var/lib/rethinkdb/data

The default port is 8080. To change it, update this line:

http-port=8089

Bind defaults to localhost. To access remotely:

bind=0.0.0.0

At this point, RethinkDB is configured to access from the web browser.

Then, enable the service and start it:

sudo systemctl enable rethinkdb@<meta charset="utf-8">instance1
sudo systemctl start rethinkdb@<meta charset="utf-8"><meta charset="utf-8">instance1

Check the status

$ sudo systemctl status rethinkdb@instance1
● rethinkdb@instance1.service - RethinkDB database server for instance 'instance1'
   Loaded: loaded (/usr/lib/systemd/system/rethinkdb@.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2021-12-02 19:52:00 EAT; 8s ago
 Main PID: 1372415 (rethinkdb)
    Tasks: 71 (limit: 23167)
   Memory: 44.0M
   CGroup: /system.slice/system-rethinkdb.slice/rethinkdb@instance1.service
           ├─1372415 /usr/bin/rethinkdb serve --config-file /etc/rethinkdb/instances.d/instance1.conf
           └─1372416 /usr/bin/rethinkdb serve --config-file /etc/rethinkdb/instances.d/instance1.conf

Dec 02 19:52:00 ipa-replica.citizix.com rethinkdb[1372415]: Running on Linux 4.18.0-305.3.1.el8_4.x86_64 x86_64
Dec 02 19:52:00 ipa-replica.citizix.com rethinkdb[1372415]: Loading data from directory /var/lib/rethinkdb/data
Dec 02 19:52:00 ipa-replica.citizix.com rethinkdb[1372415]: Listening for intracluster connections on port 29015
Dec 02 19:52:00 ipa-replica.citizix.com rethinkdb[1372415]: Listening for client driver connections on port 28015
Dec 02 19:52:00 ipa-replica.citizix.com rethinkdb[1372415]: Listening for administrative HTTP connections on port 8080
Dec 02 19:52:00 ipa-replica.citizix.com rethinkdb[1372415]: Listening on cluster addresses: 127.0.0.1, ::1
Dec 02 19:52:00 ipa-replica.citizix.com rethinkdb[1372415]: Listening on driver addresses: 127.0.0.1, ::1
Dec 02 19:52:00 ipa-replica.citizix.com rethinkdb[1372415]: Listening on http addresses: 127.0.0.1, ::1
Dec 02 19:52:00 ipa-replica.citizix.com rethinkdb[1372415]: To fully expose RethinkDB on the network, bind to all addresses by adding `bind=all' to the config file (>
Dec 02 19:52:00 ipa-replica.citizix.com rethinkdb[1372415]: Server ready, "ipa_replica_citizix_com_w7l" bbbe44e6-1cc3-4f03-9bf9-2b4cc1f7adc9

We have managed to start the service

4. Access RethinkDB Web Interface

Open your web browser and type the URLĀ http://your-server-ip:8080. You will be redirected to the RethinkDB default dashboard as shown below:

Citizix - RethinkDB page

Citizix ā€“ RethinkDB page

From here, you can easily create and manage the database and cluster.

Conclusion

We managed to install and configure RethinkDB in our Rocky Linux server.

comments powered by Disqus
Citizix Ltd
Built with Hugo
Theme Stack designed by Jimmy