Clone Snapshot API (스냅샷 복제 API)
스냅샷의 전체 또는 일부를 원본과 같은 리포지토리 안에 복제(clone)하는 API예요.
출처: OpenSearch 문서
본문
Endpoints
PUT /_snapshot/{repository}/{snapshot}/_clone/{target_snapshot}
Path parameters
다음 표는 사용할 수 있는 경로 파라미터 목록이에요.
| Parameter | Required | Data type | Description | | repository | Required | String | The name of repository which will contain the snapshots clone. | | snapshot | Required | String | The name of the original snapshot. | | target_snapshot | Required | String | The name of the cloned snapshot. |
Query parameters
다음 표는 사용할 수 있는 쿼리 파라미터 목록이에요. 모든 쿼리 파라미터는 선택 사항입니다.
| Parameter | Data type | Description | | cluster_manager_timeout | String | The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see Common parameters. |
Example request
다음 요청은 스냅샷 리포지토리 my-opensearch-repo에 있는 my_snapshot 스냅샷에서 index_a와 index_b 인덱스를 복제해, 같은 리포지토리에 my_new_snapshot이라는 새 스냅샷을 만듭니다.
REST Python
PUT /_snapshot/my-opensearch-repo/my_snapshot/_clone/my_new_snapshot
{
“indices” : “index_a,index_b”
}
Copy Copy as cURL
response = client.snapshot.clone(
repository = "my-opensearch-repo",
snapshot = "my_snapshot",
target_snapshot = "my_new_snapshot",
body = '''
{
“indices” : “index_a,index_b”
}
'''
)
Copy
Example response
스냅샷 복제가 성공적으로 생성되면 다음 응답을 반환합니다.
{
"acknowledged" : true
}
Required permissions
Security 플러그인을 사용한다면 cluster:admin/snapshot/clone 권한이 있는지 확인하세요.
더 알아보기 (Learn more)
스냅샷 복제는 같은 리포지토리 안에서만 가능하고, 복제본은 원본의 전체 데이터를 다시 백업하지 않고 효율적으로 만들어져요. 스냅샷을 복제해서 테스트 환경에서 활용하거나, 원본을 건드리지 않은 채 다른 이름의 백업을 만들고 싶을 때 유용합니다. 스냅샷 전반에 대한 내용은 OpenSearch docs의 snapshot 관련 문서를 참고해 보세요.