django-pgclone¶
django-pgclone
makes it easy to dump and restore Postgres databases.
Here are some key features:
Streaming dumps and restores to configurable storage backends like S3. Instances with limited memory aren’t a problem for large databases.
A restoration process that works behind the scenes, swapping in the restored database when finished.
Configurable hooks into the dump and restore process, for example, migrating a restored database before it is swapped.
Reversible restores, making it possible to quickly revert to the initial restore or the previous database.
Re-usable configurations for instrumenting different types of dumps and restores.
Quickstart¶
To dump a database, do:
python manage.py pgclone dump
To list database dump keys, do:
python manage.py pgclone ls
To restore a datase, do:
python manage.py pgclone restore <dump_key>
Database dumps are relative to the storage location, which defaults to
the local file system. Dump keys are in
the format of <instance>/<database>/<config>/<timestamp>.dump
.
When listing, use an optional prefix. Restoring supports the same interface, using the latest key that matches the prefix.
Compatibility¶
django-pgclone
is compatible with Python 3.7 – 3.11, Django 3.2 – 4.2, Psycopg 2 – 3 and Postgres 12 – 15.
Next steps¶
django-pgclone
can be used in a number of ways. See the
following sections for more information:
Basics - A basic overview of the app, terminology, and how default command options are determined.
Commands - Documentation for commands and their options.
Storage Backends - Configure an S3 storage backend.
Hooks - Run management command hooks during dumping or restoring.
Reversible Restores - Create restores that can be quickly reverted.
Local Copies - Create local copies that can be quickly reverted.
Configurations - For re-using command parameters.
Settings - All settings.
Dumping RDS Databases - Additional notes on Amazon RDS configuration.
See the Frequently Asked Questions for everything else.