Yet another Django DB Backup tool. Tested with Django==1.9.1
- rsync
- restore from rsync
- database & user create scripts
- gzip
- pexpect
pip install pexpect
pip install -e git+https://github.com/night-crawler/django-dbdump.git@#egg=django-dbdump
DBDUMP_DIR
: use provided directory, oros.path.join(BASE_DIR, 'dbdump')
DBDUMP_BACKENDS
: custom backends, i.e.{'django.db.backends.postgresql': 'django_dbdump.backends.psycopg2:DumpConverter'}
DBDUMP_STRFTIME_FORMAT = '%Y-%m-%d-%H%M%S'
DBDUMP_COMPRESS_ENABLED = True
DBDUMP_COMPRESS_COMMAND = 'gzip -f -9 %s'
DBDUMP_DECOMPRESS_COMMAND = 'gzip -d %s'
DBDUMP_COMPRESS_EXTENSION = '.gz'
DBDUMP_MAX_DUMPS_PER_ALIAS = 10
store max N dumpsDBDUMP_RSYNC_ENABLED = False
-rsync
disabled by defaultDBDUMP_RSYNC_PATTERN = 'rsync -raz --progress %(source)s %(destination)s'
DBDUMP_RSYNC_DESTINATION = '[email protected]:/backups/'
DBDUMP_RSYNC_PASSWORD = ''
- rsync password, if empty suppose we're using key authDBDUMP_RSYNC_DELETE = True
- remove destination files
./manage.py dbdump
--create Show create statements
--load Load database from last dump
--start-rsync Start rsync and exit
--rsync-restore Restore dumps from rsync
--max-dumps [MAX_DUMPS]
Max dumps per alias
--rsync Run rsync after dump
--no-rsync Do NOT run rsync after dump