RethinkDB: Getting Started

Learn how to set up and secure your RethinkDB instance on Stackhero

👋 Welcome to the Stackhero documentation!

Stackhero offers a ready-to-use RethinkDB cloud solution that provides a host of benefits, including:

  • Effortless updates with just a click.
  • Optimal performance and robust security powered by a private and dedicated VM.

Save time and simplify your life: it only takes 5 minutes to try Stackhero's RethinkDB cloud hosting solution!

To secure your RethinkDB instance on Stackhero, the first step is to define an admin password. Begin by connecting to the RethinkDB web UI, navigate to the "Data Explorer" tab, and run the following query:

r.db('rethinkdb').table('users').get('admin').update({ password: '<PASSWORD>' })

You can perform dump and restore operations using the RethinkDB CLI either from your computer or another server. All connections to Stackhero services are encrypted with TLS. Therefore, you need to provide the tls-cert parameter to indicate the location of your local CA certificates.

For example, to dump your RethinkDB database, you can run:

rethinkdb dump \
  --tls-cert /etc/ssl/certs/ca-certificates.crt \
  -c XXXXX.stackhero-network.com:29015 \
  -p

Because connections to RethinkDB are secured with TLS and the official RethinkDB client library does not support TLS, it is recommended to use the rethinkdbdash library instead.

You can install the library using npm:

npm install rethinkdbdash

Below is a simple example demonstrating how to connect to your database using Node.js. The example includes server settings such as host, port, and connection limits to help you get started:

const rethinkdbdash = require('rethinkdbdash');

const r = rethinkdbdash({
  servers: [
    {
      host: '<XXXXXX>.stackhero-network.com',
      port: 28015
    }
  ],
  ssl: true,
  buffer: 20, // Minimum connections to RethinkDB
  max: 100,   // Maximum connections to RethinkDB
  timeoutGb: 30 * 1000, // The pool keeps an unused connection for this duration (in ms)
  db: '<DATABASE>',
  authKey: '<PASSWORD>',
  // silent: true, // Uncomment to suppress logging on stderr
});

This guide is designed to help you get started with RethinkDB on Stackhero. By following these steps, you can ensure that your instance is secure and configured correctly.