Skip to content

Latest commit

 

History

History
53 lines (33 loc) · 1.93 KB

store-mongodb-backups-in-minio.md

File metadata and controls

53 lines (33 loc) · 1.93 KB

Store MongoDB Backups in MinIO Server Slack

In this recipe we will learn how to store MongoDB backups in MinIO Server.

1. Prerequisites

  • Install mc from here.
  • Install MinIO Server from here.
  • MongoDB official doc.

2. Configuration Steps

MinIO server is running using alias minio1. Follow MinIO client complete guide here for details. MongoDB backups are stored in mongobkp directory.

Create a bucket.

mc mb minio1/mongobkp
Bucket created successfully ‘minio1/mongobkp’.

Streaming Mongodump Archive to MinIO server.

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

Show Progress & Speed Info

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 local backup to MinIO server.

Continuously mirror mongobkp folder recursively to MinIO. Read more on mc mirror here

mc mirror --force --remove --watch  mongobkp/ minio1/mongobkp