SCP file transfer with mongo db

June 5, 2018 1.1k views
MongoDB Ubuntu 16.04

I have an app running on localhost:8080 and I have scp transferred my MongoDB dumped database to my ubuntu server and placed the dir in /var/lib/mongodb file.

My questions are:

Do I have to run mongorestore on this dir?

Also, after binding my droplet IP address what is the uri for mongo supposed to be? mongo//:<droplet ip/>:27017?

1 Answer

Hello, @Pappie

In order to restore the Mongo database you need to use the mongorestore command, that is correct.

The command will essentially look like this:

sudo mongorestore --db newdb /var/lib/mongodb

You can also check this tutorial for more detailed instructions:

https://www.digitalocean.com/community/tutorials/how-to-back-up-restore-and-migrate-a-mongodb-database-on-ubuntu-14-04

Hope this helps,

Regards,
Alex

by Anatoliy Dimitrov
MongoDB is one of the most popular NoSQL database engines. It is famous for being scalable, powerful, reliable and easy to use. In this article we'll show you how to back up, restore, and migrate your MongoDB databases.
Have another answer? Share your knowledge.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!