This file contains hidden or 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 |
This file contains hidden or 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
| #!/bin/bash | |
| # herein we backup our indexes! this script should run at like 6pm or something, after logstash | |
| # rotates to a new ES index and theres no new data coming in to the old one. we grab metadatas, | |
| # compress the data files, create a restore script, and push it all up to S3. | |
| TODAY=`date +"%Y.%m.%d"` | |
| INDEXNAME="logstash-$TODAY" # this had better match the index name in ES | |
| INDEXDIR="/usr/local/elasticsearch/data/logstash/nodes/0/indices/" | |
| BACKUPCMD="/usr/local/backupTools/s3cmd --config=/usr/local/backupTools/s3cfg put" | |
| BACKUPDIR="/mnt/es-backups/" | |
| YEARMONTH=`date +"%Y-%m"` |
This file contains hidden or 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
| # 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 |