Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Transfer MongoDB to another server?

Tags:

mongodb

If I populate a MongoDB instance on my local machine, can I wholesale transfer that database to a server and have it work without too much effort?
The reason I ask is that my server is currently an Amazon EC2 Micro instance and I need to put LOTS of data into a MongoDB and don't think I can spare the transactions and bandwidth on the EC2 instance.

like image 329
James P. Wright Avatar asked Jul 14 '11 18:07

James P. Wright


People also ask

How do I move a MongoDB database to another drive?

Copy the data folder of your mongodb to the new location - cp -R /var/lib/mongodb/ /mnt/database/ Remove the old database folder - rm -rf /var/lib/mongodb/ Create symbolic link to the new database folder - ln -s /mnt/database/mongodb /var/lib/mongodb.

Does MongoDB have migration?

The Live Migration Service is a free service that we host and operate to make it simple to migrate your database to MongoDB Atlas. This service works by making an initial copy of the data from your source database, and watching for any changes so that it stays in sync until you are ready to cut over.

How do I export a MongoDB database?

So, to export data from the MongoDB database, MongoDB provides a command-line tool known as mongoexport. Using this tool you can exports data of a collection in JSON or CSV(comma-separated value) format. Moreover, we can also use features like limit and sort on a collection while exporting the data.


1 Answers

There is copy database command which I guess should be good fit for your need.

Alternatively, you can just stop MongoDb, copy the database files to another server and run an instance of MongoDb there.

like image 160
Andrew Orsich Avatar answered Oct 29 '22 18:10

Andrew Orsich