Mongodb dump and restore
Mongodb dump and restore
Today I moved the last service from the droplet and it had a mongodb attached. To dump it and restore it in the Raspberry I did the following.
- From the
mongodb
container, this command is for dump:mongodump -d DB_NAME -o today
. It creates a folder and inside it there are a bunch of.bjson
files. - Compress the folder:
tar -cvf today.tar ./today
- File.io (the tool I used when moving the postgresql db) said I had no more space available and I used uguu:
curl -F files[][email protected] https://uguu.se/upload.php
- Copy the file into the Raspberry
- Extract the tar:
tar -xvf today.tar
- Start a new
mongodb
container with a volume attached. - Copy the folder into the volume attached
- Restore the DB:
mongorestore --db DB_NAME FOLDER
(and I used.
asFOLDER
)