Book Image

Getting Started with RethinkDB

By : Gianluca Tiepolo
Book Image

Getting Started with RethinkDB

By: Gianluca Tiepolo

Overview of this book

RethinkDB is a high-performance document-oriented database with a unique set of features. This increasingly popular NoSQL database is used to develop real-time web applications and, together with Node.js, it can be used to easily deploy them to the cloud with very little difficulty. Getting Started with RethinkDB is designed to get you working with RethinkDB as quickly as possible. Starting with the installation and configuration process, you will learn how to start importing data into the database and run simple queries using the intuitive ReQL query language. After successfully running a few simple queries, you will be introduced to other topics such as clustering and sharding. You will get to know how to set up a cluster of RethinkDB nodes and spread database load across multiple machines. We will then move on to advanced queries and optimization techniques. You will discover how to work with RethinkDB from a Node.js environment and find out all about deployment techniques. Finally, we’ll finish by working on a fully-fledged example that uses the Node.js framework and advanced features such as Changefeeds to develop a real-time web application.
Table of Contents (15 chapters)
Getting Started with RethinkDB
Credits
About the Author
Acknowledgement
About the Reviewer
www.PacktPub.com
Preface
Index

Starting RethinkDB


To start your RethinkDB instance, open a terminal window and run the following command:

sudo /etc/init.d/rethinkdb start

Note

If you're running an OS that doesn't support the init start-stop daemon, such as OS X, you'll have to start RethinkDB by running the rethinkdb command followed by the appropriate command-line options. RethinkDB must be run with superuser privileges.

If the database starts up successfully, you will get an output similar to this:

rethinkdb: instance1: Starting instance. (logging to `/var/lib/rethinkdb/instance1/data/log_file')

As you can see from the previous output, RethinkDB gives you the path of the log file. If, by any chance, the database refuses to start, check the log for any error. In a clean installation and start up, the log will contain some statements like these:

notice: Running rethinkdb 2.0.3~0trusty (GCC 4.8.2)...
notice: Running on Linux 3.13.0-36-generic x86_64
notice: Loading data from directory /var/lib/rethinkdb/instance1/data
notice: Listening for intracluster connections on port 29015
notice: Listening for client driver connections on port 28015
notice: Listening for administrative HTTP connections on port 8080
notice: Listening on addresses: 127.0.0.1, 192.168.1.125
notice: Server ready, "rethinkdb1" fa0668f9-99cb-4516-b04a-1ee5466b572c

This a great deal of information. The log file tells us that the database has started running correctly, and we can access it from the specified IP addresses. It says that the server is ready and waiting for connections. Congratulations! Now, your RethinkDB server will be up and running. It's time to run your very first ReQL query.