From 3df881ca226e22fcf6c0a7e082d7ed4472a7bfc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20S=C3=89RIE?= Date: Thu, 13 Feb 2014 19:00:48 +0100 Subject: [PATCH] New script for Elasticsearch 1.0 in actions.d/14_elasticsearch.disabled --- .../actions.d/14_elasticsearch.disabled | 40 +++++++++++++------ 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/install/etc/evobackup/actions.d/14_elasticsearch.disabled b/install/etc/evobackup/actions.d/14_elasticsearch.disabled index c4f0891..de6fb49 100755 --- a/install/etc/evobackup/actions.d/14_elasticsearch.disabled +++ b/install/etc/evobackup/actions.d/14_elasticsearch.disabled @@ -1,15 +1,29 @@ -# Dump ElasticSearch -# Disable ES translog flush -curl -s -XPUT 'localhost:9200/_settings' -d '{"index.translog.disable_flush": true}' >/dev/null -# Flushes translog -curl -s 'localhost:9200/_flush' | grep -qe '"ok":true' -# If it succeed, do an rsync of the datadir -if [ $? -eq 0 ]; then - rsync -a /var/lib/elasticsearch /home/backup/ -else - echo "Error when flushing ES translog indexes." -fi -# In any case re-enable translog flush -curl -s -XPUT 'localhost:9200/_settings' -d '{"index.translog.disable_flush": false}' > /dev/null +#!/bin/bash +# Dump/Snapshots for Elasticsearch 1.0 + +## Yout need to register a repository, this action need to be only done one time, +## but you must register a repository on all nodes! +## $ curl -XPUT 'http://localhost:9200/_snapshot/backup' -d '{ +## "type": "fs", +## "settings": { +## "location": "/home/backup-elasticsearch", +## "compress": true +## } +## }' + +## 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 \ No newline at end of file