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.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With