mongodbbackup
v2.0.0
Published
Cli for Automated MongoDB backup
Downloads
16
Maintainers
Readme
MongoDb Backup
Cli for Automated MongoDB backup. Supports AWS S3 backups, Dropbox backups, Email/HTTP notifications, pre/post hooks and internal crontab.
Installation
Install with npm:
npm install mongodbbackup -g
Configuration
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 filetar
(default) will usetar -zcvf
command to compress backup fileszip
will usezip -zcvf
command to compress backup files butsudo 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 127.0.0.1',
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"'
}]
}
Running
Need help? use --help
argument
mbk backup <path to conf.json>
Crontab
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'
Debugging
mbk backup <path to conf.json> --debug
Contribution
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~~
Contributors
We welcome contributions of all kinds from anyone.
- Author: Tümay Çeber
- Dropbox Support: Settlin [email protected]