Install RethinkDB Realtime Database on RHEL / CentOS 7 & 8

Last modified on May 30, 2020 1 min read

RethinkDB stores JSON documents with dynamic schemas and is designed to facilitate pushing real-time updates for query results to applications. Today I’m going to share how to setup RethinkDB on RHEL / CentOS.

Table of Contents

  1. Install RethinkDB
  2. Configuration
  3. Config Firewall & Test
  4. Run RethinkDB

Install RethinkDB

Let’s add RethinkDB repository provided by RethinkDB team:

# RHEL/CentOS 8
sudo wget https://download.rethinkdb.com/centos/8/`uname -m`/rethinkdb.repo -O /etc/yum.repos.d/rethinkdb.repo

# RHEL/CentOS 7
sudo wget https://download.rethinkdb.com/centos/7/`uname -m`/rethinkdb.repo -O /etc/yum.repos.d/rethinkdb.repo

After adding the repository, we can install RethinkDB using yum or dnf package manager.

sudo yum -y install rethinkdb

Configuration

You can read their configuration file documentation. Let’s create an instance of rethinkdb:

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

If you don’t have the sample .conf file, you can download it from here. Now we have to customize the instance1.conf. Open instance1.conf file:

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

Comment out these lines:

runuser=rethinkdb
rungroup=rethinkdb
directory=/var/lib/rethinkdb/default
log-file=/var/log/rethinkdb
bind=all
driver-port=28015
http-port=8080
server-name=server1

Then set permissions:

sudo chown -R rethinkdb:rethinkdb  /var/log/rethinkdb /var/lib/rethinkdb

sudo chmod -R 775 /var/log/rethinkdb /var/lib/rethinkdb

Config Firewall & Test

If firewall is active on your server, you need to open 8080 on port.

# open http port
sudo firewall-cmd --zone=public --add-port=8080/tcp --permanent

# open driver port
sudo firewall-cmd --zone=public --add-port=28015/tcp --permanent

# reload firewall
sudo firewall-cmd --reload

Now run this command to enable run RethinkDB on port 8080.

rethinkdb --bind all

Visit http://[server-ip-address]:8080 to see the web interface of RethinkDB.

Now stop exist from RethinkDB console and stop:

# exit
Ctrl + C

# stop
sudo /etc/init.d/rethinkdb stop

Run RethinkDB

Enable RethinkDB on start:

sudo systemctl enable --now rethinkdb

Start RethinkDB:

sudo systemctl start rethinkdb

Check status:

sudo systemctl status rethinkdb

Again visit http://[server-ip-address]:8080 to see the web interface of RethinkDB. You’ll see the screen like this:

Done. RethinkDB is running and available to use. Thank you. 🙂

Author

Hey, I'm Md Obydullah. I build open-source projects and write on Laravel, Linux server, modern JavaScript and more on web development.

Follow

Leave a Reply

Your email address will not be published. Required fields are marked *