Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
ElasticSearch: Creating snapshot

Based on documentation from ElasticSearch about snapshots

To create backup with ElasticSearch

  1. Create on elasticsearch node a backup folder
    mkdir /srv/webplatform/elastic_backup
    chown -R elasticsearch:elasticsearch /srv/webplatform/elastic_backup
  1. Register folder as snapshot destination
    curl -XPUT 'http://208.113.157.132:9200/_snapshot/elastic_backup' -d '{"type": "fs","settings": {"location": "/srv/webplatform/elastic_backup", "compress": true }}'
    {"acknowledged":true}
  1. List snapshot folders
    curl -XGET 'http://208.113.157.132:9200/_snapshot/elastic_backup?pretty'
    {
      "elastic_backup" : {
        "type" : "fs",
        "settings" : {
          "compress" : "true",
          "location" : "/srv/webplatform/elastic_backup"
        }
      }
    }
  1. Make a snapshot
    curl -XPUT 'http://208.113.157.132:9200/_snapshot/elastic_backup/snapshot-20141006?wait_for_completion=true'
    {
      "snapshot":{
        "snapshot":"snapshot-20141006",
        "indices":["notes"],
        "state":"SUCCESS",
        "start_time":"2014-10-06T14:35:35.562Z",
        "start_time_in_millis":1412606135562,
        "end_time":"2014-10-06T14:35:36.030Z",
        "end_time_in_millis":1412606136030,
        "duration_in_millis":468,
        "failures":[],
        "shards":{
          "total":5,
          "failed":0,
          "successful":5
        }
      }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment