본문 바로가기

IT/Elasticsearch

[Elasticsearch] snapshot (backup) 생성

#Elasticsearch (5.0.1) snapshot 생성

1. config
path.repo: ["[MOUNT_PATH]"]

2. restart all nodes

3. create backup
curl -XPUT '[IP]:9200/_snapshot/my_backup' -d '{
    "type": "fs",
    "settings": {
        "location": "[MOUNT_PATH]",
        "compress": true
    }
}'

4. check
curl -XGET '[IP]:9200/_snapshot/my_backup?pretty'

5. excute
curl -XPUT '[IP]:9200/_snapshot/my_backup/snapshot_20170801?wait_for_completion=true&pretty' -d '{
    "indices": "[INDEX]",
    "ignore_unavailable": "true",
    "include_global_state": "false"
}'

6. check during processing
curl -XGET '[IP]:9200/_snapshot/my_backup/_current?pretty'

7. check completed snapshot
curl -XGET '[IP]:9200/_snapshot/my_backup/snapshot_20170801?pretty'

8. delete snapshot
curl -XDELETE '[IP]:9200/_snapshot/my_backup/snapshot_20170801'

9. delete snapshot dump (스냅샷 과정 도중에 실행하면 실행이 중단되고 스냅샷이 제거된다)

curl -XDELETE '[IP]:9200/_snapshot/my_backup/snapshot_20170801'