Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@obazoud
Forked from karussell/backup.sh
Created March 15, 2013 16:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save obazoud/5171030 to your computer and use it in GitHub Desktop.
Save obazoud/5171030 to your computer and use it in GitHub Desktop.
# TO_FOLDER=/something
# FROM=/your-es-installation
DATE=`date +%Y-%m-%d_%H-%M`
TO=$TO_FOLDER/$DATE/
echo "rsync from $FROM to $TO"
# the first times rsync can take a bit long - do not disable flusing
rsync -a $FROM $TO
# now disable flushing and do one manual flushing
$SCRIPTS/es-flush-disable.sh true
$SCRIPTS/es-flush.sh
# ... and sync again
rsync -a $FROM $TO
$SCRIPTS/es-flush-disable.sh false
# now remove too old backups
rm -rf `find $TO_FOLDER -maxdepth 1 -mtime +7` &> /dev/null
# true or false
DISABLE=$1
curl -XPUT 'localhost:9200/_settings' -d '{
"index" : {
"translog.disable_flush" : "'$DISABLE'"
}
}'
curl -XPOST 'localhost:9200/_flush'
curl -XGET 'localhost:9200/_settings?pretty=true'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment