Driven Administrator Guide
version 2.0.5Backing Up and Restoring Driven Repositories
To be prepared for disaster recovery, you must implement a policy for taking regular snapshots of the Driven repository. Use either Amazon S3 or a filesystem repository for the backup-and-restore system.
Prerequisites for Backup to S3 Repos
If you want to back up your data to an Amazon S3 repository, the procedure for configuring Amazon Web Services (AWS) credentials depends on whether there is an embedded or an external Elasticsearch datastore for the Driven deployment.
Embedded Elasticsearch Datastore: Either configure the following parameters of the driven.properties file:
driven.aws.accesskey= driven.aws.secretkey=
Or set the following environment variables:
AWS_ACCESS_KEY_ID AWS_SECRET_KEY
External Elasticsearch Cluster: The AWS credentials are set in the Elasticsearch layer, not part of the Driven configuration. Install the Amazon Web Services Cloud plugin on the Elasticsearch cluster. The AWS credentials can be configured in several different ways, including setting properties in the YML file, environment variables, or IAM roles. See the AWS Cloud Plugin page on GitHub for more information.
The backup Command
Use the Driven CLI Client to administer backup and recovery functions. The following CLI example shows information about options that can be used with the backup command.
$ driven backup --help
java driven.management.backup.Backup [options...]
Optional:
env vars: DRIVEN_CLUSTER, DRIVEN_HOSTS
Option Description
------ -----------
--bucket S3 bucket for repository
--cluster Driven cluster name (default: driven)
--debug [Boolean] enable debugging (default: false)
--delete name of snapshot to delete from repository
--delete-older-than delete snapshots older than supplied date ( yyyy-MM-dd )
--display-width <Integer> width of display (default: 80)
--help
--hosts Driven server host(s) (default: localhost)
--json [Options$JsonOpts] output data as json (default: values)
--list list repositories, or if --repository is used list
snapshots in repository
--no-header
--path specify filesystem path for repository
--prefix S3 prefix for repository bucket (default: snapshots)
--print print query parameters
--region AWS region for repository bucket (default: us-east-1)
--register-fs register a local repository with name
--register-s3 register a remote S3 repository with name
--repository name of repository
--restore name of snapshot to restore from repository
--snapshot name of snapshot to create in repository
--unregister name of repository to unregister
--verbose logging level (default: info)
Backing Up Your Driven Data
The backup process generally entails creating a repository location and storing data snapshots there.
There are two ways to create a repository. You can either specify the repository in the driven.properties file, or you can use the Driven CLI Client to create the repository.
Step 1: - Option 1 Configure the driven.properties file to create a repository
To create only one default repository, add the following to the driven.properties file. Use either Amazon S3 or a filesystem repository:
For Amazon S3:
driven.backup.repository.type=s3 driven.backup.repository.bucket=myExampleBucketName driven.backup.repository.region=us-east-example
For shared filesystem repository:
driven.backup.repository.type=fs driven.backup.repository.path=/opt/driven-backup/snapshots
Step 1: - Option 2 Create a repository with the CLI Client
For Amazon S3 (servers in a cluster must have appropriate AWS credentials for the bucket):
$ driven backup --register-s3 s3-repo --bucket driven-backup
registered S3 repository 's3-repo' at '[us-east-example] driven-backup/snapshots'
For shared filesystem repository (all the servers in a cluster must have read/write access to the registered path):
$ driven backup --register-fs fs-repo --path /opt/driven-backup/snapshots
registered FS repository 'fs-repo' at:
'/opt/driven-backup/snapshots'
To list the repositories that you created:
$ driven backup --list
Repository Type Location
---------- -------------
s3-repo s3 s3://driven-backup/snapshots
fs-repo fs /opt/driven-backup/snapshots
Step 2: Create a snapshot
$ driven backup --repository s3-repo --snapshot snapshot_3
CREATING.........................
Snapshot State Status Started Finished
-------- ----- ------ ------- --------
snapshot_3 SUCCESS OK Thu Jun 19 10:35:08 PDT 2014 Thu Jun 19 10:35:33 PDT 2014
If no argument is given, a snapshot name with a universally unique identifier (UUID) is automatically assigned.
To list the snapshots that you created:
$ driven backup --repository s3-repo --list
Snapshot State Status Started Finished
-------- ----- ------ ------- --------
snapshot_1 SUCCESS OK Tue Jun 17 10:32:56 PDT 2014 Tue Jun 17 10:33:08 PDT 2014
snapshot_2 SUCCESS OK Tue Jun 17 11:33:02 PDT 2014 Tue Jun 17 11:33:15 PDT 2014
Restoring Data from a Snapshot
$ driven backup --repository s3-repo --restore snapshot_2
RESTORING........
snapshot snapshot_2 restore status 200
In the example above, "snapshot_2" is restored.