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:
- configuration file (-c)
- input (-i)
- output (-o)
- command (eg: elasticsearch)
- 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
- ./samples/elasticsearch_snapshot.sh # Create local snapshot
- ./samples/elasticsearch_archive.sh # Push snapshot to s3
- ./samples/elasticsearch_restore.sh
Backup
This consists of the follow two steps
- ./samples/elasticsearch_snapshot.sh # Create local snapshot
- ./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:
- ./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
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request