When you launch a rethinkdb instance, it will automatically create a database called 'test'. When you run multiple instances and cluster them using rethinkdb proxy
this leads to the issue:
Database name conflict: test is the name of more than one database
If you try to delete the databases i.e using
r.dbDrop('test').run(conn, function(result) {
console.log(result) // Will result in error
});
This will produce the following error:
ReqlOpFailedError: Database 'test' is ambiguous; there are multiple databases with that name in r.dbDrop("test")
So how to prevent RethinkDB from creating the 'test' database automatically? Or how to remove a database if you run into name conflict?
If you use rethinkdb create
to create a data directory, no test
database will be created.
For example, if rethinkdb_data
doesn't exist, this will create it with no test
database:
rethinkdb create
rethinkdb
This will do the same, but uses -d
to specify the location of the data directory:
rethinkdb create -d /var/lib/rethinkdb/data
rethinkdb -d /var/lib/rethinkdb/data