본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

Get Snapshot Status API

원문 보기 위키 갱신

Get Snapshot Status API는 스냅샷 생성 중과 생성 후에 스냅샷의 상태에 대한 자세한 정보를 반환해요. 스냅샷이 잘 진행되고 있는지, 완료되었는지 확인할 때 유용해요. 이 기능은 OpenSearch 1.0에서 처음 소개되었어요.

스냅샷 생성에 대해 배우고 싶다면 Create snapshot 문서를 참고해 주세요.

Security 플러그인을 사용한다면 monitor_snapshot, create_snapshot 또는 manage 클러스터 권한이 있어야 해요.

출처: OpenSearch 문서

본문

엔드포인트

GET _snapshot/{repository}/{snapshot}/_status

경로 매개변수

경로 매개변수는 선택 사항이에요.

| Parameter | Data type | Description | | repository | String | The repository containing the snapshot. | | snapshot | List | The snapshot(s) to return. | | index | List | The indexes to include in the response. |

다양한 유연성을 제공하는 세 가지 요청 변형이 있어요:

  • GET _snapshot/_status는 모든 저장소의 모든 현재 실행 중인 스냅샷의 상태를 반환해요.
  • GET _snapshot//_status는 지정된 저장소의 모든 현재 실행 중인 스냅샷을 반환해요. 이 변형이 권장돼요.
  • GET _snapshot///_status는 실행 중인지 여부와 관계없이 지정된 저장소의 특정 스냅샷(들)에 대한 상세 상태 정보를 반환해요.
  • GET /_snapshot////_status는 지정된 저장소의 특정 스냅샷에서 지정된 인덱스에 대한 상세 상태 정보만 반환해요. 이 엔드포인트는 특정 스냅샷에 속한 인덱스에서만 동작한다는 점을 기억해 두세요.

스냅샷 API 호출은 요청된 리소스(예: 스냅샷, 스냅샷에서 생성된 인덱스) 전체의 샤드 수가 다음 클러스터 설정이 지정한 제한보다 작을 때만 동작해요:

  • snapshot.max_shards_allowed_in_status_api(Dynamic, integer): Snapshot Status API 응답에 포함될 수 있는 최대 샤드 수. 기본값은 200000이에요. 얕은(shallow) 스냅샷 v2에는 적용되지 않는데, 이 경우 파일의 총 개수와 크기가 0으로 반환돼요.

클라우드에서 데이터를 조회할 때, 현재 실행 중이지 않은 스냅샷의 상태를 이 API로 반환하는 것은 머신 리소스와 처리 시간 측면에서 매우 비쌀 수 있어요. 스냅샷마다 요청할 때마다 모든 스냅샷 샤드의 파일을 읽게 되기 때문이에요.

요청 본문 필드

| Field | Data type | Description | | ignore_unavailable | Boolean | How to handle requests for unavailable snapshots and indexes. If false, the request returns an error for unavailable snapshots and indexes. If true, the request ignores unavailable snapshots and indexes, such as those that are corrupted or temporarily cannot be returned. Default is false. |

예제 요청

다음 요청은 my-opensearch-repo 저장소에 있는 my-first-snapshot의 상태를 반환해요. 사용할 수 없는 스냅샷은 무시돼요.

GET /_snapshot/my-opensearch-repo/my-first-snapshot/_status
{
"ignore_unavailable": true
}
response = client.snapshot.status(
repository = "my-opensearch-repo",
snapshot = "my-first-snapshot"
)

예제 응답

다음 예제는 앞의 예제 요청에 대응해요.

GET _snapshot/my-opensearch-repo/my-first-snapshot/_status 요청은 다음 필드를 반환해요:

{
"snapshots" : [
{
"snapshot" : "my-first-snapshot",
"repository" : "my-opensearch-repo",
"uuid" : "dCK4Qth-TymRQ7Tu7Iga0g",
"state" : "SUCCESS",
"include_global_state" : true,
"shards_stats" : {
"initializing" : 0,
"started" : 0,
"finalizing" : 0,
"done" : 7,
"failed" : 0,
"total" : 7
},
"stats" : {
"incremental" : {
"file_count" : 31,
"size_in_bytes" : 24488927
},
"total" : {
"file_count" : 31,
"size_in_bytes" : 24488927
},
"start_time_in_millis" : 1660666841667,
"time_in_millis" : 14054
},
"indices" : {
".opensearch-observability" : {
"shards_stats" : {
"initializing" : 0,
"started" : 0,
"finalizing" : 0,
"done" : 1,
"failed" : 0,
"total" : 1
},
"stats" : {
"incremental" : {
"file_count" : 1,
"size_in_bytes" : 208
},
"total" : {
"file_count" : 1,
"size_in_bytes" : 208
},
"start_time_in_millis" : 1660666841868,
"time_in_millis" : 201
},
"shards" : {
"0" : {
"stage" : "DONE",
"stats" : {
"incremental" : {
"file_count" : 1,
"size_in_bytes" : 208
},
"total" : {
"file_count" : 1,
"size_in_bytes" : 208
},
"start_time_in_millis" : 1660666841868,
"time_in_millis" : 201
}
}
}
},
"shakespeare" : {
"shards_stats" : {
"initializing" : 0,
"started" : 0,
"finalizing" : 0,
"done" : 1,
"failed" : 0,
"total" : 1
},
"stats" : {
"incremental" : {
"file_count" : 4,
"size_in_bytes" : 18310117
},
"total" : {
"file_count" : 4,
"size_in_bytes" : 18310117
},
"start_time_in_millis" : 1660666842470,
"time_in_millis" : 13050
},
"shards" : {
"0" : {
"stage" : "DONE",
"stats" : {
"incremental" : {
"file_count" : 4,
"size_in_bytes" : 18310117
},
"total" : {
"file_count" : 4,
"size_in_bytes" : 18310117
},
"start_time_in_millis" : 1660666842470,
"time_in_millis" : 13050
}
}
}
},
"opensearch_dashboards_sample_data_flights" : {
"shards_stats" : {
"initializing" : 0,
"started" : 0,
"finalizing" : 0,
"done" : 1,
"failed" : 0,
"total" : 1
},
"stats" : {
"incremental" : {
"file_count" : 10,
"size_in_bytes" : 6132245
},
"total" : {
"file_count" : 10,
"size_in_bytes" : 6132245
},
"start_time_in_millis" : 1660666843476,
"time_in_millis" : 6221
},
"shards" : {
"0" : {
"stage" : "DONE",
"stats" : {
"incremental" : {
"file_count" : 10,
"size_in_bytes" : 6132245
},
"total" : {
"file_count" : 10,
"size_in_bytes" : 6132245
},
"start_time_in_millis" : 1660666843476,
"time_in_millis" : 6221
}
}
}
},
".opendistro-reports-definitions" : {
"shards_stats" : {
"initializing" : 0,
"started" : 0,
"finalizing" : 0,
"done" : 1,
"failed" : 0,
"total" : 1
},
"stats" : {
"incremental" : {
"file_count" : 1,
"size_in_bytes" : 208
},
"total" : {
"file_count" : 1,
"size_in_bytes" : 208
},
"start_time_in_millis" : 1660666843076,
"time_in_millis" : 200
},
"shards" : {
"0" : {
"stage" : "DONE",
"stats" : {
"incremental" : {
"file_count" : 1,
"size_in_bytes" : 208
},
"total" : {
"file_count" : 1,
"size_in_bytes" : 208
},
"start_time_in_millis" : 1660666843076,
"time_in_millis" : 200
}
}
}
},
".opendistro-reports-instances" : {
"shards_stats" : {
"initializing" : 0,
"started" : 0,
"finalizing" : 0,
"done" : 1,
"failed" : 0,
"total" : 1
},
"stats" : {
"incremental" : {
"file_count" : 1,
"size_in_bytes" : 208
},
"total" : {
"file_count" : 1,
"size_in_bytes" : 208
},
"start_time_in_millis" : 1660666841667,
"time_in_millis" : 201
},
"shards" : {
"0" : {
"stage" : "DONE",
"stats" : {
"incremental" : {
"file_count" : 1,
"size_in_bytes" : 208
},
"total" : {
"file_count" : 1,
"size_in_bytes" : 208
},
"start_time_in_millis" : 1660666841667,
"time_in_millis" : 201
}
}
}
},
".kibana_1" : {
"shards_stats" : {
"initializing" : 0,
"started" : 0,
"finalizing" : 0,
"done" : 1,
"failed" : 0,
"total" : 1
},
"stats" : {
"incremental" : {
"file_count" : 13,
"size_in_bytes" : 45733
},
"total" : {
"file_count" : 13,
"size_in_bytes" : 45733
},
"start_time_in_millis" : 1660666842673,
"time_in_millis" : 2007
},
"shards" : {
"0" : {
"stage" : "DONE",
"stats" : {
"incremental" : {
"file_count" : 13,
"size_in_bytes" : 45733
},
"total" : {
"file_count" : 13,
"size_in_bytes" : 45733
},
"start_time_in_millis" : 1660666842673,
"time_in_millis" : 2007
}
}
}
},
".opensearch-notifications-config" : {
"shards_stats" : {
"initializing" : 0,
"started" : 0,
"finalizing" : 0,
"done" : 1,
"failed" : 0,
"total" : 1
},
"stats" : {
"incremental" : {
"file_count" : 1,
"size_in_bytes" : 208
},
"total" : {
"file_count" : 1,
"size_in_bytes" : 208
},
"start_time_in_millis" : 1660666842270,
"time_in_millis" : 200
},
"shards" : {
"0" : {
"stage" : "DONE",
"stats" : {
"incremental" : {
"file_count" : 1,
"size_in_bytes" : 208
},
"total" : {
"file_count" : 1,
"size_in_bytes" : 208
},
"start_time_in_millis" : 1660666842270,
"time_in_millis" : 200
}
}
}
}
}
}
]
}

응답 본문 필드

| Field | Data type | Description | | repository | String | Name of repository that contains the snapshot. | | snapshot | String | Snapshot name. | | uuid | String | A snapshot’s universally unique identifier (UUID). | | state | String | Snapshot’s current status. See Snapshot states. | | include_global_state | Boolean | Whether the current cluster state is included in the snapshot. | | shards_stats | Object | Snapshot’s shard counts. See Shard stats. | | stats | Object | Information about files included in the snapshot. file_count: number of files. size_in_bytes: total size of all files. See Snapshot file stats. | | index | List of Objects | List of objects that contain information about the indexes in the snapshot. See Index objects. |

스냅샷 상태(Snapshot states)

| State | Description | | FAILED | The snapshot terminated in an error and no data was stored. | | IN_PROGRESS | The snapshot is currently running. | | PARTIAL | The global cluster state was stored, but data from at least one shard was not stored. The failures property of the Create snapshot response contains additional details. | | SUCCESS | The snapshot finished and all shards were stored successfully. |

샤드 통계(Shard stats)

모든 속성 값은 정수(integer)예요.

| Property | Description | | initializing | Number of shards that are still initializing. | | started | Number of shards that have started but not are not finalized. | | finalizing | Number of shards that are finalizing but are not done. | | done | Number of shards that initialized, started, and finalized successfully. | | failed | Number of shards that failed to be included in the snapshot. | | total | Total number of shards included in the snapshot. |

스냅샷 파일 통계(Snapshot file stats)

| Property | Type | Description | | incremental | Object | Number and size of files that still need to be copied during snapshot creation. For completed snapshots, incremental provides the number and size of files that were not already in the repository and were copied as part of the incremental snapshot. | | processed | Object | Number and size of files already uploaded to the snapshot. The processed file_count and size_in_bytes are incremented in stats after a file is uploaded. | | total | Object | Total number and size of files that are referenced by the snapshot. | | start_time_in_millis | Long | Time (in milliseconds) when snapshot creation began. | | time_in_millis | Long | Total time (in milliseconds) that the snapshot took to complete. |

인덱스 객체(Index objects)

| Property | Type | Description | | shards_stats | Object | See Shard stats. | | stats | Object | See Snapshot file stats. | | shards | List of objects | Contains information about the shards included in the snapshot. OpenSearch returns the following properties about the shard: stage: The current state of shards in the snapshot. Shard states are: * DONE: The number of shards in the snapshot that were successfully stored in the repository. * FAILURE: The number of shards in the snapshot that were not successfully stored in the repository. * FINALIZE: The number of shards in the snapshot that are in the finalizing stage of being stored in the repository. * INIT: The number of shards in the snapshot that are in the initializing stage of being stored in the repository.* STARTED: The number of shards in the snapshot that are in the started stage of being stored in the repository. stats: See Snapshot file stats. total: The total number and sizes of files referenced by the snapshot. start_time_in_millis: The time (in milliseconds) when snapshot creation began. time_in_millis: The total amount of time (in milliseconds) that the snapshot took to complete. |

필요한 권한

Security 플러그인을 사용한다면 적절한 권한이 있는지 확인해 주세요: cluster:admin/snapshot/status and cluster:admin/snapshot/status*.

더 알아보기 (Learn more)

스냅샷 상태를 더 다양하게 활용하는 방법을 알고 싶다면 원문 OpenSearch 문서를 확인해 주세요.