RethinkDB is an open-source, JSON database made to continuously push updated query results to your web application. This makes it easy to develop and scale real-time web apps. In February 2017, the CNCF (Cloud Native Computing Foundation) purchased the rights to the RethinkDB source code and contributed it to The Linux Foundation under the permissive ASLv2 license.
RethinkDB for All is a general introduction to RethinkDB on Compose.
Are you wondering what you'll get, or can get, with a Compose RethinkDB deployment? Want to know what you'll need to do to manage it? Check out some of the implementation features and details down in RethinkDB for Ops and Admins.
Just deployed RethinkDB and want to get coding with it? Developing an application or want to try a new stack? Then see the
RethinkDB for Developers section for resources on how to connect from different languages, command line tools and more information to get you started.
When deployed on Compose, RethinkDB comes with these standard Compose features.
- Automatically scaling server stack that scales RAM, CPU, and I/O as your RethinkDB data grows.
- Daily, weekly, monthly, and on-demand backups.
- Metrics displayed in the Compose UI.
- Deploy, manage, backup, and otherwise automate database tasks through The Compose API.
- Guaranteed resources per deployment.
- Daily logs available for download.
Compose deployments of RethinkDB also come with a number of RethinkDB specific features:
- Data Browser for RethinkDB.
- An optional add-on for real-time log access.
- The ability to forward rich metrics to services with an optional add-on.
- Start with 1GB storage for $22.50 - as you grow each additional gigabyte costs $18.
A standard RethinkDB deployment consists of a three node cluster, and one haproxy portal to serve as a proxy and provide SSL support to the cluster. Each data node has 1GB of storage and 102MB of memory. The haproxy portal has 64MB of memory.
As with all Compose deployments, a RethinkDB deployment features automatic vertical scaling so as an application’s data size increases, the RethinkDB resources scale fluidly to maintain consistent performance. You can also manually scale up your haproxy portals and RethinkDB nodes from the deployment's Resources panel. A 10:1 ratio of disk to RAM is maintained, so by increasing the disk allocated to the deployment, you increase the RAM allocated.
It is also possible to add haproxy portals in the Security panel of the deployment.
See Compose Datacenter Availability for current location availability.
Compose deployments are billed based on disk usage and your RethinkDB deployment usage is measured hourly. It is then grouped into a single monthly billing cycle. This means that any scaling or add-on usage will be charged from when the new resource was provisioned; not just for the month. You can see your deployment's usage in the Overview panel, under Current Usage.
Initial deployment set up is $22.50/month. Depending on which scaling and add-ons options you choose, the cost will increase. For example, if you wish to add extra storage and RAM, it is billed at an additional $18/month per unit of 1GB storage/102MB memory, so an additional 2GB storage/204MB memory will cost an additional $36/month.
All RethinkDB Deployments are high-availability clusters of three nodes and one haproxy portal. RethinkDB clusters consist of a master member which will coordinate writes. The additional members can become master in the event of a node failure. The data is spread across the cluster based on the replica and shard count.
Avoid Possible Data Loss
Replication of your data across nodes is not an automatic process. You will have to configure your data to spread across shards.
RethinkDB backups use the
dump command from the RethinkDB command-line utility on your running database cluster to backup your entire deployment. It saves database and table contents as well as metadata.
dump does use some cluster resources, but will not lock-out your clients and can be run on a live cluster. Compose provides backups for RethinkDB deployments that are in a format that
rethinkdb restore can use directly.
General information on backup schedules and downloading your backups can be found on the Backups page.
Since your RethinkDB backups are available for you to download, you can get a local instance of your deployment up and running. To do so, you need to install rethink and also make sure you have the python driver in your path. Download the compressed backup file from your Compose deployment. You do not need to unpack the backup archive file, the RethinkDB tools know how to handle it.
To spin up RethinkDB, run the
rethinkdb command in one terminal window, and in a separate terminal window navigate to the location of your downloaded backup and run
rethinkdb restore backup.tar.gz. If you bring up a browser and navigate to
localhost:8080 you should see the RethinkDB UI and all of your data.
If you have a backup file locally that you would like to restore to a Compose deployment (either from another Compose instance or a local instance) you may do so using
Either way you need to install rethink and also make sure you have the python driver in your path. You will also need to download the certificate from the Compose UI and save locally as compose.cert. To restore you'd use:
rethinkdb restore -c <host>:<port> --tls-cert compose.cert -p backup.tar.gz
The host and port are those found under RethinkDB Proxy Connection strings in the Compose UI. The -p will prompt for the Authentication Credential.
Note that if you are restoring into an existing deployment you may have to use
--force to overwrite existing tables.
Since the Administrative Console is built-in to RethinkDB, it is the recommended way to interact and administrate your data outside of an application or script. However, if you wish to connect locally, using your language's driver and REPL, here are some general steps to get you started:
- Provision an SSH portal on your deployment (in the Security panel).
- Create a user and add their SSH key to your deployment (in the Users panel).
- Open an SSH tunnel to your deployment. See the Connecting to RethinkDB for more on this step, especially if you are on Mac OSX.
- In a separate terminal, start up your language's REPL, require the RethinkDB driver, and open a connection. More information on installing the client-drivers and setting up a connection can be found in the RethinkDB docs.
The Overview panel of the Compose UI provides the basic information you need to get connected to your databases. The Connection info section contains the Authentication Credential for your admin user and the RethinkDB Proxy Connection strings which will, along with the SSL Certificate, allow your application to connect to your deployment.
For more details and links to examples in many languages, see the Connecting to RethinkDB page.
The full list of documentation for RethinkDB is in the sidebar, in addition to all things Compose.
If this article didn't solve things, summon a human and get some help!