First you will need to look at your database host URL in Compose.
Log into your Compose.io account, select the database you are planning on dumping, select 'admin.'
This is the 'hostname' and port you will need to know to perform the commands shown below in your terminal.
In your terminal you will type the following:
$ mongodump -h hostURL.com:port -u user -p pass --authenticationDatabase dbId --db dbId
Using the above screen snip, the command would look like this:
$ mongodump -h alex.mongohq.com:10096 -u root -p root --authenticationDatabase Brandon --db Brandon
The output will look like this:
This will dump the database in whichever directory your terminal is currently in.
If you are unsure what directory you are in, type 'pwd' in the terminal.
The dump file will be in a folder named 'dump.' Within that folder your database files will be inside of a folder with the name of your database. You will need to know the directory which the dump is in for when you upload the database to Xervo.
Restoring database to XervoNow that you have successfully dumped your database from Compose to your local machine we will restore the database to Xervo.
You will need to create an empty database in Xervo from your project dashboard. This empty database will be filled with the contents of your database dump from compose.
Select 'CREATE' with the necessary details filled in.
Next, select that database in your dashboard and select 'administration' to find out the host URL.
The command you will type in the terminal follows:
$ mongorestore -h hostURL.com:port -u root -p root --authenticationDatabase dbId --db dbId path/to/dump
Using the above example, the command will look like this:
$ mongorestore -h percy.xervo.io -u root -p root
--authenticationDatabase abu8Papy --db abu8Papy ~/dump/Brandon
The output will appear like this:
If you receive any error similar to this:
Failed: restore error: abu8Papy.system.users: error creating indexes for abu8Papy.system.users: createIndex error: not authorized on abu8Papy to execute command
Make sure to remove any system.example files from the dump folder. You will not be able to restore these on the public cloud.
Go to top