이 페이지에서는 Cloud SQL 인스턴스로 데이터 가져오기 및 내보내기를 취소하는 방법을 설명합니다. 이 데이터는 SQL 덤프 파일 또는 CSV 파일에 포함되어 있습니다.
시작하기 전에
가져오기 또는 내보내기 작업 취소
gcloud
또는 REST API 명령어를 사용하여 가져오기 또는 내보내기 작업을 취소할 수 있습니다.
gcloud sql operations cancel
명령어를 사용하여 작업을 취소합니다.
gcloud sql operations canceloperation-ID
요청 데이터를 사용하기 전에 다음을 바꿉니다.
- project-ID: 프로젝트 ID입니다.
- operation-ID: 가져오기 또는 내보내기 작업의 ID입니다. 자세한 내용은 시작하기 전에를 참조하세요.
HTTP 메서드 및 URL:
POST https://sqladmin.googleapis.com/v1/projects/project-ID /operations/operation-ID /cancel
요청을 보내려면 다음 옵션 중 하나를 펼칩니다.
cURL(Linux, macOS, Cloud Shell)
다음 명령어를 실행합니다.
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d "" \
"https://sqladmin.googleapis.com/v1/projects/project-ID /operations/operation-ID /cancel"
PowerShell(Windows)
다음 명령어를 실행합니다.
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-Uri "https://sqladmin.googleapis.com/v1/projects/project-ID /operations/operation-ID /cancel" | Select-Object -Expand Content
다음과 비슷한 JSON 응답이 표시됩니다.
응답
{}
요청 데이터를 사용하기 전에 다음을 바꿉니다.
- project-ID: 프로젝트 ID입니다.
- operation-ID: 가져오기 또는 내보내기 작업의 ID입니다. 자세한 내용은 시작하기 전에를 참조하세요.
HTTP 메서드 및 URL:
POST https://sqladmin.googleapis.com/v1beta4/projects/project-ID /operations/operation-ID /cancel
요청을 보내려면 다음 옵션 중 하나를 펼칩니다.
cURL(Linux, macOS, Cloud Shell)
다음 명령어를 실행합니다.
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d "" \
"https://sqladmin.googleapis.com/v1beta4/projects/project-ID /operations/operation-ID /cancel"
PowerShell(Windows)
다음 명령어를 실행합니다.
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-Uri "https://sqladmin.googleapis.com/v1beta4/projects/project-ID /operations/operation-ID /cancel" | Select-Object -Expand Content
다음과 비슷한 JSON 응답이 표시됩니다.
응답
{}
취소된 상태 확인
gcloud
또는 REST API 명령어를 사용하여 취소된 가져오기 또는 내보내기 작업의 상태를 확인할 수 있습니다.
gcloud sql operations describe
명령어를 사용하여 취소된 작업의 상태를 확인합니다.
gcloud sql operations describeoperation-ID
요청 데이터를 사용하기 전에 다음을 바꿉니다.
- project-ID: 프로젝트 ID입니다.
- operation-ID: 가져오기 또는 내보내기 작업의 ID입니다. 자세한 내용은 시작하기 전에를 참조하세요.
HTTP 메서드 및 URL:
GET https://sqladmin.googleapis.com/v1/projects/project-ID /operations/operation-ID
요청을 보내려면 다음 옵션 중 하나를 펼칩니다.
cURL(Linux, macOS, Cloud Shell)
다음 명령어를 실행합니다.
curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://sqladmin.googleapis.com/v1/projects/project-ID /operations/operation-ID "
PowerShell(Windows)
다음 명령어를 실행합니다.
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://sqladmin.googleapis.com/v1/projects/project-ID /operations/operation-ID " | Select-Object -Expand Content
다음과 비슷한 JSON 응답이 표시됩니다.
응답
{ "kind": "sql#operation", "targetLink": "https://sqladmin.googleapis.com/v1/projects/project-ID ", "status": "DONE", "user": "user@example.com", "insertTime": "2022-11-08T22:12:58.199Z", "startTime": "2022-11-08T22:13:04.798Z", "endTime": "2022-11-08T22:13:45.862Z", "error": { "kind": "sql#operationErrors", "errors": [ { "kind": "sql#operationError", "code": "CANCEL_SUCCESSFUL", "message": "Operation successfully cancelled" } ] }, "operationType": "EXPORT", "exportContext": { "uri": "gs://replica-bucket/source-database.sql", "kind": "sql#exportContext", "sqlExportOptions": { "schemaOnly": false, "mysqlExportOptions": { "masterData": 0 } }, "fileType": "SQL" }, "name": "operation-ID ", "targetId": "cloud-sql-instance-display-name ", "selfLink": "https://sqladmin.googleapis.com/v1/projects/project-ID /operations/operation-ID ", "targetProject": "project-ID ", "instanceUid": "cloud-sql-instance-ID " }
요청 데이터를 사용하기 전에 다음을 바꿉니다.
- project-ID: 프로젝트 ID입니다.
- operation-ID: 가져오기 또는 내보내기 작업의 ID입니다. 자세한 내용은 시작하기 전에를 참조하세요.
HTTP 메서드 및 URL:
GET https://sqladmin.googleapis.com/v1beta4/projects/project-ID /operations/operation-ID
요청을 보내려면 다음 옵션 중 하나를 펼칩니다.
cURL(Linux, macOS, Cloud Shell)
다음 명령어를 실행합니다.
curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://sqladmin.googleapis.com/v1beta4/projects/project-ID /operations/operation-ID "
PowerShell(Windows)
다음 명령어를 실행합니다.
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://sqladmin.googleapis.com/v1beta4/projects/project-ID /operations/operation-ID " | Select-Object -Expand Content
다음과 비슷한 JSON 응답이 표시됩니다.
응답
{ "kind": "sql#operation", "targetLink": "https://sqladmin.googleapis.com/v1beta4/projects/project-ID ", "status": "DONE", "user": "user@example.com", "insertTime": "2022-11-08T22:12:58.199Z", "startTime": "2022-11-08T22:13:04.798Z", "endTime": "2022-11-08T22:13:45.862Z", "error": { "kind": "sql#operationErrors", "errors": [ { "kind": "sql#operationError", "code": "CANCEL_SUCCESSFUL", "message": "Operation successfully cancelled" } ] }, "operationType": "EXPORT", "exportContext": { "uri": "gs://replica-bucket/source-database.sql", "kind": "sql#exportContext", "sqlExportOptions": { "schemaOnly": false, "mysqlExportOptions": { "masterData": 0 } }, "fileType": "SQL" }, "name": "operation-ID ", "targetId": "cloud-sql-instance-display-name ", "selfLink": "https://sqladmin.googleapis.com/v1beta4/projects/project-ID /operations/operation-ID ", "targetProject": "project-ID ", "instanceUid": "cloud-sql-instance-ID " }
문제 해결
문제 | 문제 해결 |
---|---|
오류 메시지: You can't cancel operation [operation-ID] because
this operation isn't in progress. |
완료되었거나 실패했거나 취소된 가져오기 또는 내보내기 작업을 취소하려고 합니다. 작업이 실행 중인 경우 취소할 수 있습니다. |
오류 메시지: You can't cancel operation [operation-ID] because
Cloud SQL doesn't support the cancellation of an [operation-type]
operation. |
Cloud SQL에는 |
오류 메시지: The [operation-type] operation isn't cancelled. Wait
and retry in a few seconds. |
Cloud SQL에서 현재 가져오기 또는 내보내기 작업을 취소할 수 없습니다. 잠시 후 다시 시도하세요. 문제가 계속되면 Google Cloud 지원팀에 문의하세요. |
다음 단계
- 데이터 가져오기 및 내보내기 권장사항 자세히 알아보기
- SQL 덤프 파일을 사용해 Cloud SQL 인스턴스로 데이터 내보내기 및 가져오기 방법 알아보기
- 가져오기 및 내보내기 작업 상태 확인 방법 알아보기
- 가져오기 및 내보내기에 대해 알려진 문제