Commands
The primary usage of DBBackup is with command line tools. By default, commands will create backups and upload to your defined storage or download and restore the latest backup.
Arguments can be passed to commands to compress/uncompress and encrypt/decrypt.
dbbackup
Backup of database.
$ ./manage.py dbbackup
Backing Up Database: /tmp/tmp.x0kN9sYSqk
Backup size: 3.3 KiB
Writing file to tmp-zuluvm-2016-07-29-100954.dump
Help
usage: manage.py dbbackup [-h] [--noinput] [-q] [-c] [-d DATABASE] [-s SERVERNAME] [-z] [-e] [-o OUTPUT_FILENAME] [-O OUTPUT_PATH] [-x EXCLUDE_TABLES] [-n SCHEMA] [--version] [-v {0,1,2,3}] [--settings SETTINGS] [--pythonpath PYTHONPATH] [--traceback] [--no-color] [--force-color] [--skip-checks] Backup a database, encrypt and/or compress. options: -h, --help show this help message and exit --noinput Tells Django to NOT prompt the user for input of any kind. -q, --quiet Tells Django to NOT output other text than errors. -c, --clean Clean up old backup files -d DATABASE, --database DATABASE Database(s) to backup specified by key separated by commas(default: all) -s SERVERNAME, --servername SERVERNAME Specify server name to include in backup filename -z, --compress Compress the backup files -e, --encrypt Encrypt the backup files -o OUTPUT_FILENAME, --output-filename OUTPUT_FILENAME Specify filename on storage -O OUTPUT_PATH, --output-path OUTPUT_PATH Specify where to store on local filesystem -x EXCLUDE_TABLES, --exclude-tables EXCLUDE_TABLES Exclude tables from backup -n SCHEMA, --schema SCHEMA Specify schema(s) to backup. Can be used multiple times. --version Show program's version number and exit. -v {0,1,2,3}, --verbosity {0,1,2,3} Verbosity level; 0=minimal output, 1=normal output, 2=verbose output, 3=very verbose output --settings SETTINGS The Python path to a settings module, e.g. "myproject.settings.main". If this isn't provided, the DJANGO_SETTINGS_MODULE environment variable will be used. --pythonpath PYTHONPATH A directory to add to the Python path, e.g. "/home/djangoprojects/myproject". --traceback Raise on CommandError exceptions. --no-color Don't colorize the command output. --force-color Force colorization of the command output. --skip-checks Skip system checks.
dbrestore
- Restore a database. ::
$ ./manage.py dbrestore Restoring backup for database: /tmp/tmp.x0kN9sYSqk Finding latest backup Restoring: tmp-zuluvm-2016-07-29-100954.dump Restore tempfile created: 3.3 KiB
Help
usage: manage.py dbrestore [-h] [--noinput] [-q] [-d DATABASE] [-i INPUT_FILENAME] [-I INPUT_PATH] [-s SERVERNAME] [-c] [-p PASSPHRASE] [-z] [-n SCHEMA] [-r] [--version] [-v {0,1,2,3}] [--settings SETTINGS] [--pythonpath PYTHONPATH] [--traceback] [--no-color] [--force-color] [--skip-checks] Restore a database backup from storage, encrypted and/or compressed. options: -h, --help show this help message and exit --noinput Tells Django to NOT prompt the user for input of any kind. -q, --quiet Tells Django to NOT output other text than errors. -d DATABASE, --database DATABASE Database to restore -i INPUT_FILENAME, --input-filename INPUT_FILENAME Specify filename to backup from -I INPUT_PATH, --input-path INPUT_PATH Specify path on local filesystem to backup from -s SERVERNAME, --servername SERVERNAME If backup file is not specified, filter the existing ones with the given servername -c, --decrypt Decrypt data before restoring -p PASSPHRASE, --passphrase PASSPHRASE Passphrase for decrypt file -z, --uncompress Uncompress gzip data before restoring -n SCHEMA, --schema SCHEMA Specify schema(s) to restore. Can be used multiple times. -r, --no-drop Don't clean (drop) the database. This only works with mongodb and postgresql. --version Show program's version number and exit. -v {0,1,2,3}, --verbosity {0,1,2,3} Verbosity level; 0=minimal output, 1=normal output, 2=verbose output, 3=very verbose output --settings SETTINGS The Python path to a settings module, e.g. "myproject.settings.main". If this isn't provided, the DJANGO_SETTINGS_MODULE environment variable will be used. --pythonpath PYTHONPATH A directory to add to the Python path, e.g. "/home/djangoprojects/myproject". --traceback Raise on CommandError exceptions. --no-color Don't colorize the command output. --force-color Force colorization of the command output. --skip-checks Skip system checks.
mediabackup
Backup media files, gather all in a tarball and encrypt or compress.
$ ./manage.py mediabackup
Backup size: 10.0 KiB
Writing file to zuluvm-2016-07-04-081612.tar
Help
usage: manage.py mediabackup [-h] [--noinput] [-q] [-c] [-s SERVERNAME] [-z] [-e] [-o OUTPUT_FILENAME] [-O OUTPUT_PATH] [--version] [-v {0,1,2,3}] [--settings SETTINGS] [--pythonpath PYTHONPATH] [--traceback] [--no-color] [--force-color] [--skip-checks] Backup media files, gather all in a tarball and encrypt or compress. options: -h, --help show this help message and exit --noinput Tells Django to NOT prompt the user for input of any kind. -q, --quiet Tells Django to NOT output other text than errors. -c, --clean Clean up old backup files -s SERVERNAME, --servername SERVERNAME Specify server name to include in backup filename -z, --compress Compress the archive -e, --encrypt Encrypt the backup files -o OUTPUT_FILENAME, --output-filename OUTPUT_FILENAME Specify filename on storage -O OUTPUT_PATH, --output-path OUTPUT_PATH Specify where to store on local filesystem --version Show program's version number and exit. -v {0,1,2,3}, --verbosity {0,1,2,3} Verbosity level; 0=minimal output, 1=normal output, 2=verbose output, 3=very verbose output --settings SETTINGS The Python path to a settings module, e.g. "myproject.settings.main". If this isn't provided, the DJANGO_SETTINGS_MODULE environment variable will be used. --pythonpath PYTHONPATH A directory to add to the Python path, e.g. "/home/djangoprojects/myproject". --traceback Raise on CommandError exceptions. --no-color Don't colorize the command output. --force-color Force colorization of the command output. --skip-checks Skip system checks.
mediarestore
Restore media files, extract files from archive and put into media storage.
$ ./manage.py mediarestore
Restoring backup for media files
Finding latest backup
Reading file zuluvm-2016-07-04-082551.tar
Restoring: zuluvm-2016-07-04-082551.tar
Backup size: 10.0 KiB
Are you sure you want to continue? [Y/n]
2 file(s) restored
Help
usage: manage.py mediarestore [-h] [--noinput] [-q] [-i INPUT_FILENAME] [-I INPUT_PATH] [-s SERVERNAME] [-e] [-p PASSPHRASE] [-z] [-r] [--version] [-v {0,1,2,3}] [--settings SETTINGS] [--pythonpath PYTHONPATH] [--traceback] [--no-color] [--force-color] [--skip-checks] Restore a media backup from storage, encrypted and/or compressed. options: -h, --help show this help message and exit --noinput Tells Django to NOT prompt the user for input of any kind. -q, --quiet Tells Django to NOT output other text than errors. -i INPUT_FILENAME, --input-filename INPUT_FILENAME Specify filename to backup from -I INPUT_PATH, --input-path INPUT_PATH Specify path on local filesystem to backup from -s SERVERNAME, --servername SERVERNAME If backup file is not specified, filter the existing ones with the given servername -e, --decrypt Decrypt data before restoring -p PASSPHRASE, --passphrase PASSPHRASE Passphrase for decrypt file -z, --uncompress Uncompress gzip data before restoring -r, --replace Replace existing files --version Show program's version number and exit. -v {0,1,2,3}, --verbosity {0,1,2,3} Verbosity level; 0=minimal output, 1=normal output, 2=verbose output, 3=very verbose output --settings SETTINGS The Python path to a settings module, e.g. "myproject.settings.main". If this isn't provided, the DJANGO_SETTINGS_MODULE environment variable will be used. --pythonpath PYTHONPATH A directory to add to the Python path, e.g. "/home/djangoprojects/myproject". --traceback Raise on CommandError exceptions. --no-color Don't colorize the command output. --force-color Force colorization of the command output. --skip-checks Skip system checks.
listbackups
This command helps to list backups filtered by type ('media'
or 'db'
),
by compression or encryption.
Help
usage: manage.py listbackups [-h] [--noinput] [-q] [-d DATABASE] [-z] [-Z] [-e] [-E] [-c CONTENT_TYPE] [--version] [-v {0,1,2,3}] [--settings SETTINGS] [--pythonpath PYTHONPATH] [--traceback] [--no-color] [--force-color] [--skip-checks] options: -h, --help show this help message and exit --noinput Tells Django to NOT prompt the user for input of any kind. -q, --quiet Tells Django to NOT output other text than errors. -d DATABASE, --database DATABASE Filter by database name -z, --compressed Exclude non-compressed -Z, --not-compressed Exclude compressed -e, --encrypted Exclude non-encrypted -E, --not-encrypted Exclude encrypted -c CONTENT_TYPE, --content-type CONTENT_TYPE Filter by content type 'db' or 'media' --version Show program's version number and exit. -v {0,1,2,3}, --verbosity {0,1,2,3} Verbosity level; 0=minimal output, 1=normal output, 2=verbose output, 3=very verbose output --settings SETTINGS The Python path to a settings module, e.g. "myproject.settings.main". If this isn't provided, the DJANGO_SETTINGS_MODULE environment variable will be used. --pythonpath PYTHONPATH A directory to add to the Python path, e.g. "/home/djangoprojects/myproject". --traceback Raise on CommandError exceptions. --no-color Don't colorize the command output. --force-color Force colorization of the command output. --skip-checks Skip system checks.