This scripts
Original script are provided by @karelbemelmans
Our customized script replace URL to shell variable and split file with function.
edit shell-variables
URL
: Elasticsearch base urlREPO
: Snapshot repository nameLIMIT
: Number of snapshots to keep
- Elasticsearch 1.4, 2, 5 maybe
- curl
- jq JSON Parser command
call simply.
elasticsearch-backup-jobs.sh
This script simply execute elasticsearch-take-snapshot.sh
, elasticsearch-snapshot-rotation.sh
internally.
Most easiest way to backup.
45 23 * * * /etc/bacula/pre-backup.d/elasticsearch-backup-jobs.sh
or drop into /etc/cron.{daily,weekly,monthly}
...
Specify in bacula-dir.conf
.
Job {
ClientRunBeforeJob = "/etc/bacula/pre-backup.d/elasticsearch-backup-jobs.sh"
}
- Jenkins, or another CIs.
elasticsearch-take-snapshot.sh
elasticsearch-snapshot-rotation.sh
curl -X GET http://localhost:9200/_snapshot/es_backup/_all 2>/dev/null | jq -r '.snapshots [] .snapshot'