Book Image

Mastering RethinkDB

By : Shaikh
Book Image

Mastering RethinkDB

By: Shaikh

Overview of this book

RethinkDB has a lot of cool things to be excited about: ReQL (its readable,highly-functional syntax), cluster management, primitives for 21st century applications, and change-feeds. This book starts with a brief overview of the RethinkDB architecture and data modeling, and coverage of the advanced ReQL queries to work with JSON documents. Then, you will quickly jump to implementing these concepts in real-world scenarios, by building real-time applications on polling, data synchronization, share market, and the geospatial domain using RethinkDB and Node.js. You will also see how to tweak RethinkDB's capabilities to ensure faster data processing by exploring the sharding and replication techniques in depth. Then, we will take you through the more advanced administration tasks as well as show you the various deployment techniques using PaaS, Docker, and Compose. By the time you have finished reading this book, you would have taken your knowledge of RethinkDB to the next level, and will be able to use the concepts in RethinkDB to develop efficient, real-time applications with ease.
Table of Contents (11 chapters)

Creating and handling a RethinkDB cluster


We have done enough of theory; let's deal with clustering in RethinkDB. Till now we have covered what clustering really is in terms of computing and what it provides us. In this section, we are going to learn how we can perform clustering in RethinkDB, which by nature is a distributed database.

We will also learn how to add new machines into our existing cluster, manage them from the RethinkDB administrative screen, and monitor them for any errors.

We have two ways to perform RethinkDB clustering:

  • In the same machine with a different RethinkDB instance

  • In a different machine with a different RethinkDB instance

Creating a RethinkDB cluster in the same machine

We can create a RethinkDB cluster in the same machine using the simple command under a minute. Yes you heard it right, in a minute (assuming you have RethinkDB installed). Let's do this.

Lift up the default RethinkDB server using the following command in the terminal:

rethinkdb

It should lift the RethinkDB...