项目作者: Drivetech

项目描述 :
Docker Image with Alpine Linux, mongorestore and awscli for restore mongo backup from s3
高级语言: Shell
项目地址: git://github.com/Drivetech/mongorestore-s3.git
创建时间: 2016-09-20T21:50:26Z
项目社区:https://github.com/Drivetech/mongorestore-s3

开源协议:

下载


mongorestore-s3

dockeri.co

Build Status

Docker Image with Alpine Linux, mongorestore and awscli for restore mongo backup from s3

Use

Restore complete database from backup 2016-09-20_06-00-00_UTC.gz in s3

  1. docker run -d --name mongorestore \
  2. -v /tmp/backup:/backup
  3. -e "BACKUP_NAMES=2016-09-20_06-00-00_UTC.gz"
  4. -e "MONGO_URI=mongodb://user:pass@host:port/dbname"
  5. -e "AWS_ACCESS_KEY_ID=your_aws_access_key"
  6. -e "AWS_SECRET_ACCESS_KEY=your_aws_secret_access_key"
  7. -e "AWS_DEFAULT_REGION=us-west-1"
  8. -e "S3_BUCKET=your_aws_bucket"
  9. lgatica/mongorestore-s3

Restore only collections collection1 and collection2 from backup 2016-09-20_06-00-00_UTC.gz in s3

  1. docker run -d --name mongorestore \
  2. -v /tmp/backup:/backup
  3. -e "BACKUP_NAMES=2016-09-20_06-00-00_UTC.gz"
  4. -e "MONGO_URI=mongodb://user:pass@host:port/dbname"
  5. -e "AWS_ACCESS_KEY_ID=your_aws_access_key"
  6. -e "AWS_SECRET_ACCESS_KEY=your_aws_secret_access_key"
  7. -e "AWS_DEFAULT_REGION=us-west-1"
  8. -e "S3_BUCKET=your_aws_bucket"
  9. -e "COLLECTIONS=collection1,collection2"
  10. lgatica/mongorestore-s3

Restore complete database from backup 2016-09-20_06-00-00_UTC.gz in s3 with “—noIndexRestore”

  1. docker run -d --name mongorestore \
  2. -v /tmp/backup:/backup
  3. -e "BACKUP_NAMES=2016-09-20_06-00-00_UTC.gz"
  4. -e "MONGO_URI=mongodb://user:pass@host:port/dbname"
  5. -e "AWS_ACCESS_KEY_ID=your_aws_access_key"
  6. -e "AWS_SECRET_ACCESS_KEY=your_aws_secret_access_key"
  7. -e "AWS_DEFAULT_REGION=us-west-1"
  8. -e "S3_BUCKET=your_aws_bucket"
  9. -e EXTRA="--noIndexRestore"
  10. lgatica/mongorestore-s3

IAM Policity

You need to add a user with the following policies. Be sure to change your_bucket by the correct.

  1. {
  2. "Version": "2012-10-17",
  3. "Statement": [
  4. {
  5. "Sid": "Stmt1412062044000",
  6. "Effect": "Allow",
  7. "Action": [
  8. "s3:PutObject",
  9. "s3:GetObject",
  10. "s3:PutObjectAcl"
  11. ],
  12. "Resource": [
  13. "arn:aws:s3:::your_bucket/*"
  14. ]
  15. },
  16. {
  17. "Sid": "Stmt1412062128000",
  18. "Effect": "Allow",
  19. "Action": [
  20. "s3:ListBucket"
  21. ],
  22. "Resource": [
  23. "arn:aws:s3:::your_bucket"
  24. ]
  25. }
  26. ]
  27. }

Extra environmnet

  • S3_PATH - Default value is mongodb. Example s3://your_bucket/mongodb/
  • EXTRA - Default not set. Set extra parameters

License

MIT