New script for Elasticsearch 1.0

in actions.d/14_elasticsearch.disabled
This commit is contained in:
Benoît S. 2014-02-13 19:00:48 +01:00
parent 8188f83d66
commit 3df881ca22

View file

@ -1,15 +1,29 @@
# Dump ElasticSearch #!/bin/bash
# Disable ES translog flush # Dump/Snapshots for Elasticsearch 1.0
curl -s -XPUT 'localhost:9200/_settings' -d '{"index.translog.disable_flush": true}' >/dev/null
# Flushes translog ## Yout need to register a repository, this action need to be only done one time,
curl -s 'localhost:9200/_flush' | grep -qe '"ok":true' ## but you must register a repository on all nodes!
# If it succeed, do an rsync of the datadir ## $ curl -XPUT 'http://localhost:9200/_snapshot/backup' -d '{
if [ $? -eq 0 ]; then ## "type": "fs",
rsync -a /var/lib/elasticsearch /home/backup/ ## "settings": {
else ## "location": "/home/backup-elasticsearch",
echo "Error when flushing ES translog indexes." ## "compress": true
fi ## }
# In any case re-enable translog flush ## }'
curl -s -XPUT 'localhost:9200/_settings' -d '{"index.translog.disable_flush": false}' > /dev/null
## Delete old snapshots. Handled in EvoBackup.
# rm -rf /home/backup/elasticsearch/*
## Take a snapshot on master node.
# date=$(date +%Y%m%d%H%M)
# curl -XPUT "localhost:9200/_snapshot/backup/snapshot_${date}?wait_for_completion=true"
## To restore: List snapshots, close all indexes & restore one snapshot.
## curl -XGET "localhost:9200/_snapshot/backup/_all?pretty=true"
## curl -XPOST "localhost:9200/_all/_close"
## rsync master node:/home/backup/elasticsearch to slaves nodes
## example : rsync -av --delete /home/backup/elasticsearch node:/home/backup/elasticsearch
## restore snapshots
## curl -XPOST "localhost:9200/_snapshot/backup/snapshot_DATE/_restore?wait_for_completion=true"
exit 0 exit 0