Skip to content

Latest commit

 

History

History
63 lines (40 loc) · 1.24 KB

README.md

File metadata and controls

63 lines (40 loc) · 1.24 KB

MongoDB backup to Minio object storage

How to run Minio object storage

docker run -d -v /home/ubuntu/minio-data:/data -p 80:9000 minio/minio server /data

How to get Minio API connection info

docker logs <minio-container-name-OR-id>

How to add object storage host to mc (minio client)

./mc config host add minio-qa http://10.0.0.2 <Minio Access Key> <Minio Secret Key>

How to add script to crontab

edit /etc/crontab and add this;

MongoDB

39 *    * * *   ubuntu    cd /home/ubuntu/mongo-backup && ./mongo-backup.sh qa localhost 27017 <mongodb_root> <mongodb_password>

Than reload crontab

sudo service cron reload

MONGODB

How to backup mongodb

mongodump -h localhost -p 27017 -u <mongodb_root> -p <mongodb_password> --archive --gzip | ./mc pipe minio-qa/mongodb-qa-backup/mongo-qa-backup-`date +%Y-%m-%d`.archive.gz

How to restore mongodb

All

mongorestore --gzip --archive=mongo-data-2018-09-17.archive.gz

Only one db

mongorestore --gzip --archive=mongo-data-2018-09-17.archive.gz --db TestDB

Documents

https://docs.minio.io/docs/minio-client-quickstart-guide

https://docs.minio.io/docs/minio-client-complete-guide