I created a database on my local ubuntu machine.
How can I transfer it to my remote server (ec2 Ubuntu)
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.
Use mongodump
and mongorestore
to take (and restore) a full binary backup of your MongoDB database. Compress the backup dump
directory to make it faster to copy to your Amazon instance (BSON tends to compress very well).
Rather than following adhoc instructions, I would strongly recommend reading the standard Backup and Restore with MongoDB Tools tutorial in the MongoDB manual.
You can also use a Filesystem snapshot, but mongodump
and mongorestore
only export the data so your backup will be smaller (i.e. your remote server will not inherit any excessive storage allocation due to preallocation).
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