Dump/restore a whole CouchDB server contents to/from a single tar.gz file.
Useful for making backups, or replicating your database to a secondary test environment.
How it works?
coucharchive spawns a local CouchDB instance locally, using a temporary directory for storing data and configuration.
When dumping, it replicates your source CouchDB server (i.e. replicates all dbs, including _users) to the fresh local one, then saves and compresses its data to a tar.gz archive.
When loading, it uncompresses the archive, has the local CouchDB instance use it as its data, then replicated to your remote CouchDB server.
Set-up the database server info in config.ini:
[database] url = http://my-server.com:5984 username = root password = p4ss
Dumping database to a file:
./coucharchive.py -c config.ini dump -o /tmp/coucharchive.tar.gz
Restoring database from an archive:
./coucharchive.py -c config.ini load -i /tmp/coucharchive.tar.gz
For instance, save a backup to S3 and notify somebody via email:
aws s3 cp /tmp/archive.tar.gz s3://my-backups/archive.tar.gz cat >/tmp/email.txt <<EOM Subject: New backup saved on S3
A CouchDB backup called archive.tar.gz was successfully created and pushed on Amazon S3. EOM sendmail firstname.lastname@example.org </tmp/email.txt