Updated Export Docker Mongo Data (markdown)

Lauri Ojansivu 2019-09-10 18:57:12 +03:00
parent bc80a06704
commit b76bb83d7e

@ -112,13 +112,17 @@ docker cp wekan-db:/dump .
docker cp dump wekan-db:/data/ docker cp dump wekan-db:/data/
docker exec -it wekan-db bash docker exec -it wekan-db bash
cd /data cd /data
mongorestore --drop --noIndexRestore --db wekan /data/dump/wekan/ ## Only if you get errors about existing indexes, use this instead:
## mongorestore --drop --noIndexRestore --db wekan /data/dump/wekan/
mongorestore --drop --db wekan /data/dump/wekan/
exit exit
``` ```
That dbname can be for example wekan: That dbname can be for example wekan:
``` ```
mongorestore --drop --noIndexRestore --db wekan /data/dump/wekan/ ## Only if you get errors about existing indexes, use this instead:
## mongorestore --drop --noIndexRestore --db wekan /data/dump/wekan/
mongorestore --drop --db wekan /data/dump/wekan/
``` ```
9b) Or restore to another mongo database, in different port: 9b) Or restore to another mongo database, in different port:
@ -187,7 +191,9 @@ if [ $? = 0 ]; then
tar -zx -f $1 -C $SCRIPTPATH/backups/$DATE-restore tar -zx -f $1 -C $SCRIPTPATH/backups/$DATE-restore
docker exec -t wekan-db bash -c "rm -fr /restore ; mkdir /restore" docker exec -t wekan-db bash -c "rm -fr /restore ; mkdir /restore"
docker cp $SCRIPTPATH/backups/$DATE-restore/wekan wekan-db:/restore docker cp $SCRIPTPATH/backups/$DATE-restore/wekan wekan-db:/restore
docker exec -t wekan-db bash -c "mongorestore --drop --noIndexRestore --db wekan /restore/wekan/" ## Only if you get errors about existing indexes, use this instead:
## docker exec -t wekan-db bash -c "mongorestore --drop --noIndexRestore --db wekan /restore/wekan/"
docker exec -t wekan-db bash -c "mongorestore --drop --db wekan /restore/wekan/"
fi fi
else else
echo "wekan-db container is not running" echo "wekan-db container is not running"