Add support for CouchDB backup and restore functionality in Trove.
Launchpad Blueprint: https://blueprints.launchpad.net/trove/+spec/couchdb-backup-restore
CouchDB is one of the NoSQL databases that Trove supports. While Trove provides support for doing backups and restores, this functionality has not been implemented for CouchDB.
The recommended method for doing full backups in CouchDB is to do a simple filesystem copy of the data files . Since CouchDB does not officially support incremental backups, this feature will not be implemented in this release.
CouchDB is a document based database system where each database consist of several documents and each document is a JSON structure. In CouchDB, each document is associated with a revision number. Each database is stored as a single .couch file which is an append-only file (Every time a change is made to the document, it does not overwrite the existing document, instead it creates a new document with an updated version number). This makes it easy to do a full backup by simply copying this .couch file.
The following steps give a high level overview of the full backup and restore process for CouchDB.
Backup process is explained as follows:
Restore process is explained as follows:
The following configuration options will be updated with the corresponding values for CouchDB:
- backup namespace
- restore namespace
The following commands will be functional for CouchDB after these changes:
- create –backup
The CouchDB guestagent will be modified to add support for full backup and restore functionality. In addition, new strategies will also be added to support these new features.
Since CouchDB does not officially support incremental backups, an alternative to doing this is to use the CouchDB replication interface. CouchDB’s replication interface supports master-master replication model and replicates at the database level. It uses the REST API to trigger replication between databases on a source and target systems. If the databases are not on the same system, the source/target should be specified in a URI format:
An example of a request for replicating database ‘db1’ from a local server to a remote server on x.x.x.x server would be:
When replication is enabled for a database from a source to target system, it uses the document revision numbers to track differences and detect conflicts and resolve it.
TBD (section added after approval)
There will only be one work item for this feature. This includes implementing the strategies for CouchDB backup and restore and make the necessary guestagent changes. This will also include test-cases necessary to test the new functionalities.
Add new test cases to test backup and restore functionality for CouchDB:
- Add new unit tests to test the newly implemented functionality
- Add a new CouchDB helper class to the existing integration-test framework.
The datastore documentation should be updated to reflect the enabled features.
|||Filesystem Backup: http://wiki.apache.org/couchdb/FilesystemBackups?action=show|