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

Create Snapshot API (스냅샷 생성)

원문 보기 위키 갱신

1.0에서 도입

기존 리포지토리(repository) 안에 스냅샷(snapshot)을 생성합니다.

  • 스냅샷에 대해 자세히 알아보려면 Snapshots를 참고하세요.
  • 리포지토리 목록을 보려면 Get snapshot repository를 참고하세요.

출처: OpenSearch 문서

본문

Endpoints

PUT /_snapshot/{repository}/{snapshot}
POST /_snapshot/{repository}/{snapshot}

Path parameters

| Parameter | Data type | Description | | repository | String | 스냅샷을 저장할 리포지토리 이름입니다. | | snapshot | String | 생성할 스냅샷의 이름입니다. |

Query parameters

| Parameter | Data type | Description | | wait_for_completion | Boolean | 계속 진행하기 전에 스냅샷 생성이 완료될 때까지 기다릴지 여부입니다. 이 매개변수를 포함하면 생성 완료 후 스냅샷 정의가 반환됩니다. |

Request body fields

요청 본문은 선택 사항입니다.

| Field | Data type | Description | | indices | String | 스냅샷에 포함할 인덱스입니다. ,를 사용해 인덱스 목록을 만들고, *로 인덱스 패턴을 지정하며, -로 특정 인덱스를 제외할 수 있습니다. 항목 사이에 공백을 넣지 마세요. 기본값은 모든 인덱스입니다. | | ignore_unavailable | Boolean | indices 목록의 인덱스가 존재하지 않을 때 스냅샷을 실패시키지 않고 무시할지 여부입니다. 기본값은 false입니다. | | include_global_state | Boolean | 스냅샷에 클러스터 상태를 포함할지 여부입니다. 기본값은 true입니다. | | partial | Boolean | 부분 스냅샷(partial snapshot)을 허용할지 여부입니다. 기본값은 false이며, 하나 이상의 샤드가 데이터 저장에 실패하면 전체 스냅샷이 실패합니다. |

Example requests

다음 예제들은 스냅샷을 만드는 방법을 보여 줍니다.

Request without a body

다음 요청은 my-s3-repository라는 S3 리포지토리에 my-first-snapshot이라는 스냅샷을 생성합니다. 요청 본문은 선택 사항이므로 포함되지 않습니다.

REST Python

POST /_snapshot/my-s3-repository/my-first-snapshot

Copy Copy as cURL

response = client.snapshot.create(
repository = "my-s3-repository",
snapshot = "my-first-snapshot",
body = { "Insert body here" }
)

Copy

Request with a body

요청 본문을 추가해 특정 인덱스를 포함/제외하거나 다른 설정을 지정할 수도 있습니다.

REST Python

PUT /_snapshot/my-s3-repository/2
{
"indices": "opensearch_dashboards*,my-index*,-my-index-2016",
"ignore_unavailable": true,
"include_global_state": false,
"partial": false
}

Copy Copy as cURL

response = client.snapshot.create(
repository = "my-s3-repository",
snapshot = "2",
body =   {
"indices": "opensearch_dashboards*,my-index*,-my-index-2016",
"ignore_unavailable": true,
"include_global_state": false,
"partial": false
}
)

Copy

Example responses

성공 시 응답 내용은 wait_for_completion 쿼리 매개변수를 포함했는지 여부에 따라 달라집니다.

wait_for_completion not included
{
"accepted": true
}

스냅샷이 생성되었는지 확인하려면 Get snapshot API에 스냅샷 이름을 snapshot 경로 매개변수로 전달해 사용하세요.

wait_for_completion included

스냅샷 정의가 반환됩니다.

{
"snapshot" : {
"snapshot" : "5",
"uuid" : "ZRH4Zv7cSnuYev2JpLMJGw",
"version_id" : 136217927,
"version" : "2.0.1",
"indices" : [
".opendistro-reports-instances",
".opensearch-observability",
".kibana_1",
"opensearch_dashboards_sample_data_flights",
".opensearch-notifications-config",
".opendistro-reports-definitions",
"shakespeare"
],
"data_streams" : [ ],
"include_global_state" : true,
"state" : "SUCCESS",
"start_time" : "2022-08-10T16:52:15.277Z",
"start_time_in_millis" : 1660150335277,
"end_time" : "2022-08-10T16:52:18.699Z",
"end_time_in_millis" : 1660150338699,
"duration_in_millis" : 3422,
"failures" : [ ],
"shards" : {
"total" : 7,
"failed" : 0,
"successful" : 7
}
}
}

Response body fields

| Field | Data type | Description | | snapshot | String | 스냅샷 이름입니다. | | uuid | String | 스냅샷의 범용 고유 식별자(UUID)입니다. | | version_id | Integer | 스냅샷을 생성한 OpenSearch 버전의 빌드 ID입니다. | | version | Float | 스냅샷을 생성한 OpenSearch 버전입니다. | | indices | Array | 스냅샷에 포함된 인덱스입니다. | | data_streams | Array | 스냅샷에 포함된 데이터 스트림입니다. | | include_global_state | Boolean | 현재 클러스터 상태가 스냅샷에 포함되는지 여부입니다. | | start_time | String | 스냅샷 생성 프로세스가 시작된 날짜/시간입니다. | | start_time_in_millis | Long | 스냅샷 생성 프로세스가 시작된 시간(밀리초)입니다. | | end_time | String | 스냅샷 생성 프로세스가 종료된 날짜/시간입니다. | | end_time_in_millis | Long | 스냅샷 생성 프로세스가 종료된 시간(밀리초)입니다. | | duration_in_millis | Long | 스냅샷 생성 프로세스가 지속된 총 시간(밀리초)입니다. | | failures | Array | 스냅샷 생성 중 발생한 실패(있는 경우)입니다. | | shards | Object | 생성된 총 샤드 수와 성공/실패한 샤드 수입니다. | | state | String | 스냅샷 상태입니다. 가능한 값: IN_PROGRESS, SUCCESS, FAILED, PARTIAL. | | remote_store_index_shallow_copy | Boolean | 원격 저장소(remote store) 인덱스의 스냅샷이 얕은 복사본(shallow copy)으로 캡처되는지 여부입니다. 기본값은 false입니다. | | pinned_timestamp | Long | 스냅샷이 참조하는 원격 저장소 파일의 암시적 잠금을 위해 스냅샷이 고정한 타임스탬프(밀리초)입니다. |

Required permissions

Security 플러그인을 사용한다면 적절한 권한을 갖추었는지 확인하세요: cluster:admin/snapshot/create.

더 알아보기 (Learn more)