Skip to content

Instantly share code, notes, and snippets.

@mid0111
Created April 9, 2014 02:18
Show Gist options
  • Save mid0111/10219907 to your computer and use it in GitHub Desktop.
Save mid0111/10219907 to your computer and use it in GitHub Desktop.

create snapshot directory

$ sudo mkdir -p /mnt/elasticsearch/data

regist repository

$ curl -XPUT 'http://localhost:9200/_snapshot/backup' -d '{
  "type": "fs",
  "settings": {
    "location": "/mnt/elasticsearch/data",
    "compress": true
  }
}'

show repository infomation

$ curl -XGET 'http://localhost:9200/_snapshot/backup?pretty'

create snapshot

$ TODAY=`date +%Y%m%d`
$ curl -XPUT "localhost:9200/_snapshot/backup/snapshot_${TODAY}?wait_for_completion=true"

list snapshot

$ curl -XGET 'http://localhost:9200/_snapshot/backup/_all?pretty'

restore

$ TARGET_DATE=
$ curl -XPOST "http://localhost:9200/_snapshot/backup/snapshot_${TARGET_DATE}/_restore"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment