- You have minio client library installed, if not follow mc install instructions
- You have a Minio server configured and running, if not follow Minio install instructions
- You have a directory which stores all the database backup, this will get backed up on Minio server.
- My current working directory is
/home/miniouser
& scripts are part of thebash PATH
- My scripts are executable
which mc
on terminal will give you path formc
$ mc mb local/mongobkp
Bucket created successfully ‘local/mongobkp’.
$ mc mirror mongobkp/ local/mongobkp
mirror script
#!/bin/bash
#FileName: Minimongobkp.sh & has executable permissions.
LocalBackupPath="/home/miniouser/mongobkp"
MinioBucket="local/mongobkp"
MCPATH="/home/miniouser/go/bin/mc"
$MCPATH --quiet mirror $LocalBackupPath $MinioBucket
Setting it on crontab
Open crontab
& add the script in the end of the file. This script will take your mongoDB directory backup everyday at 15:00.
$ crontab -e
00 15 * * * /home/miniouser/scripts/Miniomongobkp.sh