Backarch

Ability to backup and restore ElasticSearch to AWS S3.

Installation

Add this line to your application's Gemfile:

gem 'backarch'

And then execute:

$ bundle

Or install it yourself as:

$ gem install backarch

Usage

Common usage of backarch involves passing the following:

  1. configuration file (-c)
  2. input (-i)
  3. output (-o)
  4. command (eg: elasticsearch)
  5. subcommand (eg: archive)
Example:
snapshot_archive -c samples/elasticsearch_archive.yaml -i /tmp/elasticsearch_snapshots/full -o /tmp/elasticsearch_snapshots/archive elasticsearch archive

Further examples can be found in the samples/ folder.

Backarch examples (see samples/ folder)

Commands below will backup and then restore elasticsearch from s3

  1. ./samples/elasticsearch_snapshot.sh # Create local snapshot
  2. ./samples/elasticsearch_archive.sh # Push snapshot to s3
  3. ./samples/elasticsearch_restore.sh

Backup

This consists of the follow two steps

  1. ./samples/elasticsearch_snapshot.sh # Create local snapshot
  2. ./samples/elasticsearch_archive.sh # Push snapshot to s3
Snapshot
DATE=`date +%Y%m%d`
snapshot_archive -c tmp/elasticsearch_archive.yaml -i /usr/local/var/elasticsearch/ -o /tmp/elasticsearch_snapshots -l debug -d $DATE elasticsearch snapshot
Archive
DATE=`date +%Y%m%d`
snapshot_archive -c samples/elasticsearch_archive.yaml -i /tmp/elasticsearch_snapshots/full -o /tmp/elasticsearch_snapshots/archive -l debug -d $DATE elasticsearch archive

Restore

Restoration involves downloading a multivolume tar file from s3 and then extracting the contents:

  1. ./samples/elasticsearch_restore.sh
Shell
DATE=`date +%Y%m%d`
snapshot_archive -c tmp/elasticsearch_archive.yaml -i s3://backups.qa.data-axle.infogroup.com/development/elasticsearch/full/place_directory/20140606/nil/20140606 -o /tmp/elasticsearch_restoration -l debug elasticsearch restore

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request