RethinkDB overview
RethinkDB is built to store JSON documents, and scale to multiple machines with very little effort. It has a pleasant query language that supports really useful queries like table joins and group by, and is easy to setup and learn.
Simple programming model:
- JSON data model and immediate consistency.
- Distributed joins, subqueries, aggregation, atomic updates.
- Secondary, compound, and arbitrarily computed indexes.
- Hadoop-style map/reduce.
Easy administration:
- Friendly web and command-line administration tools.
- Takes care of machine failures and network interrupts.
- Multi-datacenter replication and failover.
Horizontal scalability:
- Sharding and replication to multiple nodes.
- Queries are automatically parallelized and distributed.
- Lock-free operation via MVCC concurrency.
RethinkDB compared to other databases:
- Read the FAQ for information on architectural tradeoffs.
- Find out how RethinkDB compares to MongoDB.
- See our take on what makes RethinkDB different.
Thirty second quickstart
Install RethinkDB
Follow the installation instructions to set up RethinkDB. If you're on Ubuntu, it will only take a minute!
Start the server
Now start RethinkDB server like this:
$ rethinkdb
info: Creating directory 'rethinkdb_data'
info: Listening for intracluster connections on port 29015
info: Listening for client driver connections on port 28015
info: Listening for administrative HTTP connections on port 8080
info: Server ready
Point your browser to localhost:8080 – you'll see an administrative UI
where you can control the cluster (which so far consists of one machine), and
play with the query language.
Run some queries
Click on the Data Explorer tab in the browser. You can manipulate
data using JavaScript straight from your browser. By default,
RethinkDB creates a database named test. Let's create a table:
r.db('test').tableCreate('tv_shows')
Use the "Run" button or Shift+Enter to run the query. Now, let's insert some JSON documents into the table:
r.table('tv_shows').insert([{ name: 'Star Trek TNG', episodes: 178 },
{ name: 'Battlestar Galactica', episodes: 75 }])
We've just inserted two rows into the tv_shows table. Let's verify the
number of rows inserted:
r.table('tv_shows').count()
Finally, let's do a slightly more sophisticated query. Let's find all shows with more than 100 episodes.
r.table('tv_shows').filter(r.row('episodes').gt(100))
As a result, we of course get the best science fiction show in existence.
Next steps
Congrats, you're on your way to database bliss! Now move on to the ten minute guide and learn about distributed joins, sharding, and map/reduce queries.