Cli for Automated MongoDB backup
Last updated a month ago by s7dhansh .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @settlin/mongo-backup -g
SYNC missed versions from official npm registry.

MongoDb Backup cli

Cli for Automated MongoDB backup. Supports AWS S3 backups, Dropbox backups, Email/HTTP notifications, pre/post hooks and internal crontab. Forked from https://github.com/brendtumi/mongo-backup

NPM version Downloads Dependency Status


Install with npm:

npm install @settlin/mongo-backup -g


Example configuration file examples/conf.json

Create configuration file using

mbk example <path for conf.json>

Use any command in mongodump with same name (without '--')

archive options

  • gzip this will automagically add --gzip and --archive arguments for compressing backup file
  • tar (default) will use tar -zcvf command to compress backup files
  • zip will use zip -zcvf command to compress backup files but sudo apt-get install zip should be installed

For example: excludeCollection: 'test' will add --excludeCollection test to mongodump command.

email notification Look at nodemailer for email notification support. %s in email body will be replaced with backup result.

Sample backup result:

    part: 'mongodb',
    steps: {
        '1': '2016-07-19T14:51:23+03:00',
        '2': '2016-07-19T14:51:23+03:00',
        '3': '2016-07-19T14:53:52+03:00',
        '4': '2016-07-19T15:26:50+03:00'
    dump: {
        tmp: '/tmp/tmp-2721hWBSejbRpHQn',
        name: '2016-07-19_14-51.gz',
        output: '/tmp/tmp-2721hWBSejbRpHQn/2016-07-19_14-51.gz'
    to: [{
        Expiration: 'expiry-date="Tue, 18 Oct 2016 00:00:00 GMT", rule-id="Rule for the Entire Bucket"',
        Location: 'https://xxxx.s3.eu-central-1.amazonaws.com/2016-07-19_14-51.gz',
        Bucket: 'backups',
        Key: '2016-07-19_14-51.gz',
        ETag: '"e1bfa5e25186e64b014db6f3af882534-84"'


Need help? use --help argument

mbk backup <path to conf.json>
mbk backup <path to conf.json> --cron='* * * * * *'

But I need to close terminal window. How can I run without cancelling backup script? Well use nohup or use default job scheduler (crontab etc.)

nohup mbk backup /home/ubuntu/backup.json --cron='* 5 * * * *' > /home/ubuntu/backuplog.out 2> /home/ubuntu/backuplog.err < /dev/null &
Changing temporary directory

Temporary directory should be exist and must have appropriate write permissions.

mbk backup <path to conf.json> --tmp='/absolute/and/existing/directory'
mbk backup <path to conf.json> --debug


This is a fairly new tool, so any contribution are welcomed. What should we focus?

  • FTP/SFTP support
  • Testing
  • Amazon EFS
  • Dropbox like support
  • Debugging
  • Temporary dir option


We welcome contributions of all kinds from anyone.

My boss wants a license. So where is it?

MIT License

Current Tags

  • 2.2.3                                ...           latest (a month ago)

7 Versions

  • 2.2.3                                ...           a month ago
  • 2.2.2                                ...           2 months ago
  • 2.2.1                                ...           10 months ago
  • 2.2.0                                ...           a year ago
  • 2.1.0                                ...           a year ago
  • 2.0.1                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
Maintainers (1)
Today 0
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 1
Dependencies (16)
Dev Dependencies (1)
Dependents (0)

Copyright 2014 - 2016 © taobao.org |