RethinkDB Cloud

This add-on is operated by Byte Sized Code, LLC

Managed RethinkDB instances.

RethinkDB Cloud

Last Updated: 04 February 2014

The RethinkDB Cloud add-on is currently in beta.

Table of Contents

RethinkDB Cloud is an add-on for providing a RethinkDB instance.

Adding a RethinkDB instance to an application provides a NoSQL datastore with awesome features, such as joins.

RethinkDB is has officially supported client libraries for Ruby, Python, Javascript and many more non-official clients.

Provisioning the add-on

RethinkDB Cloud can be attached to a Heroku application via the CLI:

A list of all plans available can be found here.

$ heroku addons:add rethinkdb-cloud:small
-----> Adding rethinkdb-cloud to sharp-mountain-4005... done, v18 (free)

It can take up to an additional 15 minutes for your instance to finish being provisioned. Once rethinkdb-cloud has been added the RETHINKDB_HOST, RETHINKDB_PORT and RETHINKDB_AUTH settings will be available in the app configuration and will contain all the information to connect to your RethinkDB instance. This can be confirmed using the heroku config:get command.

$ heroku config:get RETHINKDB_HOST
173.123.987.5
$ heroku config:get RETHINKDB_PORT
4949
$ heroku config:get RETHINKDB_AUTH
123DJKIS34BXU

After installing RethinkDB Cloud add-on the application should be configured to fully integrate with the add-on.

Local setup

Service setup

RethinkDB can be installed for use in a local development environment. Typically this entails installing the software and pointing RETHINKDB_HOST and RETHINKDB_PORT to the local service.

If you have… Install with…
Mac OS X brew install rethinkdb
Ubuntu Linux sudo add-apt-repository ppa:rethinkdb/ppa && sudo apt-get update && sudo apt-get install rethinkdb
Other Build from source

Using with Rails 3.x

Ruby on Rails applications will need to add the following entry into their Gemfile specifying the RethinkDB Cloud add-on client library.

gem 'rethinkdb'

Update application dependencies with bundler.

$ bundle install

Example usage to create the table “tv_shows” and to insert a JSON record.

require 'rubygems'
require 'rethinkdb'

include RethinkDB::Shortcuts

r.connect({:host => ENV['RETHINK_HOST'],
           :port => ENV['RETHINKDB_PORT'],
           :authKey => ENV['RETHINKDB_AUTH']}).repl

r.db('test').table_create('tv_shows').run
r.table('tv_shows').insert({ 'name'=>'Star Trek TNG' }).run

Here is the ruby driver’s documentation.

If you want to use an ORM you can use nobrainer.

Using with Python/Django

$ pip install rethinkdb

Example usage to create the table “tv_shows” and to insert a JSON record.

import os
import rethinkdb as r

r.connect(host=os.environ['RETHINKDB_HOST'],
          port=os.environ['RETHINKDB_PORT'],
          auth_key=os.environ['RETHINKDB_AUTH']).repl()

r.db('test').table_create('tv_shows').run()
r.table('tv_shows').insert({ 'name': 'Star Trek TNG' }).run()

Here is the python driver’s documentation.

Using with NodeJS

$ npm install rethinkdb

Example usage to create the table “tv_shows” and to insert a JSON record.

r = require('rethinkdb')
r.connect({ host: process.env.RETHINKDB_HOST,
            port: process.env.RETHINKDB_PORT,
            authKey: process.env.RETHINKDB_AUTH }, function(err, conn) {
  if(err) throw err;
  r.db('test').tableCreate('tv_shows').run(conn, function(err, res) {
    if(err) throw err;
    console.log(res);
    r.table('tv_shows').insert({ name: 'Star Trek TNG' }).run(conn, function(err, res) {
      if(err) throw err;
      console.log(res);
    });
  });

Here is the javascript driver’s documentation.

Monitoring & Logging

RethinkDB Cloud add-on activity can be observed within the Heroku log-stream..

$ heroku logs -t | grep 'rethinkdb-cloud pattern'

Dashboard

For more information on the features available within the RethinkDB Cloud add-on dashboard please see the docs at www.rethinkdbcloud.com/documentation.

The RethinkDB Cloud add-on dashboard lets you manage the firewall to the RethinkDB Web UI and lets you access the RethinkDB Web UI which allows you to manage databases and tables. It lets you manage how your data is sharded and replicated.

The dashboard can be accessed via the CLI:

$ heroku addons:open rethinkdb-cloud
Opening rethinkdb-cloud for sharp-mountain-4005…

or by visiting the Heroku apps web interface and selecting the application in question. Select RethinkDB Cloud add-on from the Add-ons menu.

Troubleshooting

It can take up to 15 minutes for your app to finish being provisioned after you add it to your app. Once it has finished being provisioned your app’s environment variables will be updated to the correct information.

Migrating between plans

Application owners should carefully manage the migration timing to ensure proper application function during the migration process.

You data is not migrated from the free shared plan to the larger dedicated plans.

Use the heroku addons:upgrade command to migrate to a new plan.

$ heroku addons:upgrade rethinkdb-cloud:newplan
-----> Upgrading rethinkdb-cloud:newplan to sharp-mountain-4005... done, v18 ($49/mo)
       Your plan has been updated to: rethinkdb-cloud:newplan

Removing the add-on

The RethinkDB Cloud add-on can be removed via the CLI.

This will destroy all associated data and cannot be undone!

$ heroku addons:remove rethinkdb-cloud
-----> Removing rethinkdb-cloud from sharp-mountain-4005... done, v20 (free)

Support

All RethinkDB Cloud support and runtime issues should be submitted via on of the Heroku Support channels. Any non-support related issues or product feedback is welcome at support@rethinkdbcloud.com.