Learn How To Setup RethinkDB Cluster On CentOS 7

April 25, 2019

Table of Contents


RethinkDB is a NoSQL database that stores data as JSON documents. It has a super intuitive query language and has features commonly available in traditional RDBMS like “table joins” and “group by”. This tutorial will explain how to setup a RethinkDB cluster using 3 IT Web Services VPS servers running CentOS 7.


Spin up An ITWeb.Services VM with CentOS 7 as the operating system and Private Networking enabled.

Once the VM is ready, login and add the RethinkDB yum repository to the list of repositories:

sudo wget http://download.rethinkdb.com/centos/6/`uname -m`/rethinkdb.repo -O /etc/yum.repos.d/rethinkdb.repo

Next, install RethinkDB:

sudo yum install rethinkdb

Accessing Database

Start RethinkDB by running command below. Note that we’re “binding to all” so that we don’t run into issues when trying to access RethinkDB’s web admin interface.

rethinkdb --bind all

To access via web, use port 8080 by typing http://[itweb.services-ip-address]:8080 in the address bar of your web browser. You should see RethinkDB’s awesome web administration tool.

Note: If you do not see the web administration tool, stop RethinkDB by issuing the Ctrl + C command. We will open up the CentOS firewall and restart RethinkDB:

sudo firewall-cmd --zone=public --add-port=8080/tcp --permanent
sudo firewall-cmd --zone=public --add-service=http --permanent
sudo firewall-cmd --reload
rethinkdb --bind all

Remove Test Database

We will be using the web interface going forward to manipulate the database. Access it by browsing to http://[itweb.services-ip-address]:8080 and click on the “Tables” link. You will see that RethinkDB already installed a “test” database. Click on the “Data Explorer” link and run below command to delete the “test” database.


Playing Around in Database

While still on the “Data Explorer” section of RethinkDB’s admin, create a new database named “tweetDB” by running the code below.


Next, create a “tweets” table.


Insert some records into the “tweets” table.

        name: 'Lami',
        twitterHandle: 'mrLami',
        message: 'Best cloud hosting on the planet - itweb.services'
        name: 'IT Web Services Hosting',
        twitterHandle: '@TheIT Web Services',
        message: '50% off on new instances - coupon - tgif'

Query “tweets” table to see results.


You should see the following under tree view (with different id’s).

        "id":  "6afe436c-7db4-4c86-b4db-3279acb3265d" ,
        "message":  "50% off on new instances - coupon - tgif" ,
        "name":  "IT Web Services Hosting" ,
        "twitterHandle":  "@TheIT Web Services"
    } ,
        "id":  "fd328cd5-d9f4-40ee-8a32-880cd8cda15d" ,
        "message":  "Best cloud hosting on the planet - itweb.services" ,
        "name":  "Lami" ,
        "twitterHandle":  "mrLami"

Setting Up Cluster

Spin up a second and third machine using instructions from the “Installation”, “Connect To Your New VM Instance” and “Accessing Database” sections of this guide. Make sure to delete the “test” database on each of the new instances, and DO NOT add any new databases to them.

After deleting the “test” database from second and third instances, go back to their command prompts and stop RethinkDB by issuing Ctrl + C (or Cmd + C on Mac). Now start RethinkDB again on these instances by using the below command (we’re basically telling new second and third instances to join the first).

$ rethinkdb --join [ip-of-first-itweb.services-vm]:29015 --bind all

On the second and third instances, access web admin interfaces, and go to the “Data Explorer” section. Run the following query to get a list of tweets.


You will see that they have already replicated from the master (first VM setup) instance.


Although RethinkDB is still in its infancy at the time of this writing, it holds a lot of promise and has a powerful web-based administration interface that makes arduous tasks usually involved with scaling a database (sharding, replication) easily accomplished with just a few clicks.

For further reading, visit the RethinkDB Docs. Also check out #rethinkdb IRC channel to learn more from the community.

Other Versions

https://www.itweb.services/tutorials/linux-guides/setup-rethinkdb-cluster-on-centos-7″>CentOS 7

https://www.itweb.services/tutorials/linux-guides/setup-rethinkdb-cluster-on-ubuntu-14″>Ubuntu 14

Need help?

Do you need help setting up this on your own service?
Please contact us and we’ll provide you the best possible quote!