Skip to content

Instantly share code, notes, and snippets.

@graste
Last active February 26, 2016 10:07
Show Gist options
  • Save graste/db5a2f910bdbab8a8b49 to your computer and use it in GitHub Desktop.
Save graste/db5a2f910bdbab8a8b49 to your computer and use it in GitHub Desktop.
Elasticsearch Snapshotting

Snapshot Konfiguration

Verzeichnis anlegen und Snapshot konfigurieren dafür:

sudo mkdir /mnt/es_snapshots
sudo chown elasticsearch.elasticsearch /mnt/es_snapshots
curl -XPUT 'localhost:9200/_snapshot/es_snapshots' -d '{"type": "fs", "settings": {"location": "/mnt/es_snapshots", "compress": true}}'

Snapshot erstellen

curl -XPUT 'localhost:9200/_snapshot/es_snapshots/snapshot_1?wait_for_completion=true'

Snapshot einspielen

Indices löschen, falls sie schon bestehen (curl -XDELETE localhost:9200/*) und dann restore anwerfen:

curl -XPOST 'localhost:9200/_snapshot/es_snapshots/snapshot_1/_restore?wait_for_completion=true'

Snapshots packen

tar -czvf es_snapshots.tgz es_snapshots/

Snapshots kopieren

r=recursive,p=preserve

scp -P722 -rp [email protected]:/mnt/es_snapshots .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment