티스토리 뷰

elasticsearch.yml 수정

스냅샷 경로 추가
path.repo: ["/backup"]

( [] 안에 경로 표기)

새 스냅숏 레포지터리 등록
PUT "http://192.168.100.7:9200/_snapshot/backup?pretty"
{
    "type": "fs",
    "settings": {
        "location": "/backup",
        "compress": true
    }
}

응답 출력
{
  "acknowledged": true
}

모든 스냅샷 레포지터리 검색
GET /_snapshot/_all?pretty

응답 출력
{
  "backup": {
    "type": "fs",
    "settings": {
      "compress": "true",
      "location": "D:/backup"
    }
  }
}

엘라스틱서치 DB 스냅샷 만들기
PUT /_snapshot/backup/snapshot_001?wait_for_completion=true&pretty

DB 용량 만큼 백업이 진행되기 때문에 Timeout 설정을 짧게 해놨으면 타임아웃 에러가 나지만 백업 폴더를 확인하면 백업이 진행되고 있음 확인.
테스트시 15.8GB 용량 스냅샷 완성까지 약 8분 소요. (첫번째 생성 이후 스냅샷은 데이터가 있을시 추가부분만 백업되어 빨리 찍힘.)

특정 인덱스만 설정해서도 스냅샷 만들기 가능

스냅샷 리스트 확인
GET /_cat/snapshots/backup?v&s=id&pretty

응답 출력
id            status start_epoch start_time end_epoch  end_time duration indices successful_shards failed_shards total_shards
snapshot_001 SUCCESS 1657679786  11:36:26   1657680243 11:44:03     7.6m       3                11             0           11

특정 스냅샷 정보 검색
GET /_snapshot/backup/snapshot_001?pretty

응답 출력
{
  "snapshots": [
    {
      "snapshot": "snapshot_001",
      "uuid": "b80eB7bTTAqYibBFM1vy_A",
      "version_id": 5061699,
      "version": "5.6.16",
      "indices": [
        "sensor",
        ".kibana",
        "qg2"
      ],
      "state": "SUCCESS",
      "start_time": "2022-07-13T02:36:26.563Z",
      "start_time_in_millis": 1657679786563,
      "end_time": "2022-07-13T02:44:03.972Z",
      "end_time_in_millis": 1657680243972,
      "duration_in_millis": 457409,
      "failures": [],
      "shards": {
        "total": 11,
        "failed": 0,
        "successful": 11
      }
    }
  ]
}

-----------------------------------------------------------------------------------------------------------------------------------------------------------

스냅샷 복원

탄력적 검색 스냅샷 복원
POST /_snapshot/backup/snapshot_index_account_001/_restore?pretty

복원전에 index가 안닫혀 있다면 오류 뜸. index 닫고 진행해야 함.

인덱스 닫기 명령
POST /accounts/_close?pretty

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2025/06   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
글 보관함