In this recipe we will learn how to store MongoDB backups in MinIO Server.
MinIO server is running using alias minio1
. Follow MinIO client complete guide here for details. MongoDB backups are stored in mongobkp
directory.
mc mb minio1/mongobkp
Bucket created successfully ‘minio1/mongobkp’.
Examples included w/ SSH tunneling & progress bar.
On a trusted/private network stream db 'blog-data' :
mongodump -h mongo-server1 -p 27017 -d blog-data --archive | mc pipe minio1/mongobkp/backups/mongo-blog-data-`date +%Y-%m-%d`.archive
Securely stream entire mongodb server using --archive
option. encrypted backup. We'll add ssh [email protected]
to the command from above.
mongodump -h mongo-server1 -p 27017 --archive | ssh [email protected] mc pipe minio1/mongobkp/full-db-`date +%Y-%m-%d`.archive
We'll add a pipe to the utility pv
. (Install with either brew install pv
or apt-get install -y pv
)
mongodump -h mongo-server1 -p 27017 --archive | pv -brat | ssh [email protected] mc pipe minio1/mongobkp/full-db-`date +%Y-%m-%d`.archive
Continuously mirror mongobkp
folder recursively to MinIO. Read more on mc mirror
here
mc mirror --force --remove --watch mongobkp/ minio1/mongobkp