make sure docker is installed
sudo apt install borgbackup
mkdir -p ~/borgbackups
borg init -e none borgbackups/mongodb
Copy and adjust environment file
cp env-template environments/my-server-01
vi environments/my-server-01
Replicaset HOST example:
HOST=rs0/mongo01.myserver.com,mongo02.myserver.com,mongo03.myserver.com
WARNING: the script has no existence or validity check for the environment file yet!
# run example:
/path/to/create_backup.sh /path/to/environments/my-server-01
Extract backup to some location:
mkdir /home/chris/restore
cd /home/chris/restore
borg extract /home/chris/borgbackups/mongodb::2019-11-23-16-48-01
WARNING: the script has no existence or validity check for the environment file yet!
# run example:
/home/chris/mongodb-backup-restore/restore_backup.sh /home/chris/mongodb-backup-restore/environments/my-server-01
Copy and adjust environment file
cp env-cp-template environments/cp-old-new-env
vi environments/cp-old-new-env
WARNING: the script has no existence or validity check for the environment file yet!
# run example:
/path/to/copy_database.sh /path/to/environments/cp-old-new-env