Search code examples
database-administrationrethinkdb

Easiest way to copy/duplicate a RethinkDB database?


How can I easily duplicate my production database (mydb) to create a dev database (mydb-dev)?

The rethinkdb restore command seems to have no option to specify the name of the output database. It only has the option to select which database I'd like to restore from the dump. I'm using rethinkdb 1.16.3


Solution

  • You can use rethinkdb export, extract the archive, and rename the directory inside before importing it:

    $ rethinkdb export
    $ cd rethinkdb_export_2015-04-05T13:54:43
    $ mv mydb mydb_dev
    $ rethinkdb import -d ./
    

    Thinker tool by internalfx also allows you to clone a database to a different DB, using the --targetDB= option.