Part of the Joyent MongoDB Instance is Joyent QuickBackup, a fast MongoDB backup service powered by mongodump on the back end. This service is pre-configured with the username and password but is disabled by default. The only things you need to configure are the minute, hour, day, and expiredays.
In this topic:
To configure the backup service, use the svccfg command to set the following values. By default, the service is set to backup every night at midnight.
|Property||Description||Accepted Values||Default Value|
|quickbackup/username||MongoDB user for QuickBackup||16 characters||qb-xxxxxxxx|
|quickbackup/password||MongoDB password for QuickBackup||41 characters||xxxxxxxxxxx|
|quickbackup/minute||Minute of the hour to backup||0-60 comma separated or 'all'||0|
|quickbackup/hour||Hour of the day to backup||0-23 comma separated or 'all'||0|
|quickbackup/day||Day of the week to backup||sun-sat comma separated or 'all'||all|
|quickbackup/expiredays||Number of days to keep backups||1-255 or 'none'||3|
|quickbackup/databases||Name of databases to backup||dbname1,dbname2 or 'all'||all|
|quickbackup/backupdir||Name of directory to backup to||/directory||/var/backups/mongodb|
To see the current settings, use the svcprop command like this:
For example, to perform a backup every 15 minutes of every hour Monday through Friday, you would use the following svccfg commands:
After setting the properties use the svcadm command to refresh and restart the service:
Each backup is contained as a single file in the /var/backups/mongodb directory. The filename format is %Y-%m-%d_%H-%M-%S-backup.tar.gz. The backup files contain all of the databases by default or each database you specify in the quickbackup/databases property.
QuickBackup logs all status messages for backups to /var/log/mongodb/quickbackup-mongodb.log. If a backup complets successfully, you will see a confirmation message at the end of the log file.
At the end of every backup QuickBackup will do a clean up of old backup files and remove them if the age of the files exceeds the value set for quickbackup/expiredays. It does this by checking the last modification time of the backup file.
To make a backup manually (not on a schedule) with QuickBackup you can call the script by its self.
After the backup it will rotate the backup files to quickbackup/expiredays set.
To restore a backup, the MongoDB service must be running. You can check this by running the following SMF command:
You then need to specify the path to the backups you want to restore in the following way:
If successful, you will see a confirmation message that the restore completed successfully. If you receive an error, check the QuickBackup restore log file at /var/log/mongodb/quickbackup-mongodb.log.