-
-
Save Pyppe/d9f70131b58f333dc655 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XPOST http://localhost:9200/_optimize | |
curl -XPOST http://localhost:9200/_flush | |
curl -XPOST http://localhost:9200/_all/_close | |
# DO THE BACKUP | |
curl -XPOST http://localhost:9200/_all/_open |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Script to be placed in elasticsearch/bin | |
# Launch it from elasticsearch dir | |
# bin/backup indexname | |
# We suppose that data are under elasticsearch/data | |
# It will create a backup file under elasticsearch/backup | |
if [ -z "$1" ]; then | |
INDEX_NAME="dummy" | |
else | |
INDEX_NAME=$1 | |
fi | |
# Optimize index | |
curl -XPOST http://localhost:9200/$INDEX_NAME/_optimize | |
# Flush index | |
curl -XPOST http://localhost:9200/$INDEX_NAME/_flush | |
# Close index | |
curl -XPOST http://localhost:9200/$INDEX_NAME/_close | |
# Backup you data dir | |
mkdir backup | |
tar zcf backup/$INDEX_NAME.tar.gz data/elasticsearch/nodes/*/indices/$INDEX_NAME/ | |
# Then reopen index | |
curl -XPOST http://localhost:9200/$INDEX_NAME/_open |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment