이 페이지의 일부 또는 모든 정보는 S3NS의 Cloud de Confiance에 적용되지 않을 수 있습니다. 자세한 내용은
Google Cloud와의 차이점 을 참조하세요.
인스턴스 스토리지 용량 축소
이 페이지에서는 스토리지 축소 기능을 사용하여 Cloud SQL 인스턴스의 스토리지 용량을 관리하는 방법을 보여줍니다.
시작하기 전에
기능의 제한사항 을 검토합니다.
gcloud CLI 를 사용하는 경우 최신 버전의 Google Cloud SDK 및 gcloud CLI를 사용하고 있는지 확인합니다.
최신 gcloud CLI 버전 설치
현재 gcloud CLI 버전을 확인하려면 gcloud --version를 실행하세요.
gcloud CLI 버전을 업데이트하려면 gcloud components update를 실행합니다.
다음 IAM 권한을 가져옵니다.
cloudsql.instances.getDiskShrinkConfig
cloudsql.instances.performDiskShrink
이러한 권한은 다음 역할 중 하나에서 사용할 수 있습니다. 역할을 할당할 때는 최소 권한의 원칙을 적용하는 것이 좋습니다.
Cloud SQL 관리자 (roles/cloudsql.admin)
Cloud SQL 편집자 (roles/cloudsql.editor)
자세한 내용은 다음 리소스를 참조하세요.
인스턴스 준비
시작하기 전에 다음 요구사항을 완료하세요.
이 단계는 기본 인스턴스와 읽기 복제본에 동일하게 적용됩니다.
읽기 복제본을 업데이트하는 경우 먼저 기본 인스턴스의 용량을 줄인 다음 복제본의 크기를 줄여야 합니다.
관리하려는 인스턴스가 포함된 프로젝트의 프로젝트 ID를 가져옵니다 .
인스턴스의 현재 상태를 확인 하여 실행 중인지 확인합니다. 확인하는 한 가지 방법은 describe 명령어를 사용하는 것입니다.
gcloud sql instances describe
다음 상태를 반환합니다.
RUNNABLE
그렇지 않으면 인스턴스를 시작 합니다.
현재 인스턴스의 백업을 만듭니다 . 이렇게 하면 구성 중에 문제가 발생할 경우 나중에 인스턴스를 복원 할 수 있습니다.
아웃바운드 연결을 사용 설정하거나 아웃바운드 데이터 전송이 필요한 모든 확장 프로그램 또는 기능을 사용 중지합니다.
인스턴스의 스토리지 용량 축소
다음 단계는 기본 인스턴스와 읽기 복제본에 동일하게 적용됩니다.
인스턴스의 타겟 최소 스토리지 용량과 예상 작업 시간을 확인합니다. 이 정보는 스토리지 축소 작업을 계획하는 데 도움이 됩니다.
참고: 읽기 복제본에서는 이 기능을 사용할 수 없습니다. 읽기 복제본 스토리지 용량은 일반적으로 연결된 기본 인스턴스와 일치합니다.
gcloud gcloud sql instances get-storage-shrink-config 명령어를 실행합니다.
gcloud sql instances get-storage-shrink-config INSTANCE_NAME
다음을 바꿉니다.
INSTANCE_NAME : 기본 인스턴스 이름입니다.
응답에는 minimalTargetSizeGb 값이 포함됩니다. 이 값을 사용하여 스토리지 축소 작업을 실행할 때 --storage-size 매개변수에 사용할 값을 확인할 수 있습니다.
또한 응답은 다음과 비슷한 예상 작업 시간이 포함된 메시지를 반환합니다.
...
"The estimated operation time is 20 minutes".
REST v1 GET 메서드를 사용하여 인스턴스의 타겟 최소 스토리지 용량을 확인합니다.
요청 데이터를 사용하기 전에 다음을 바꿉니다.
PROJECT_ID : 기본 인스턴스가 있는 프로젝트의 이름
INSTANCE_ID : 기본 인스턴스의 인스턴스 ID입니다.
HTTP 메서드 및 URL:
GET https://sqladmin.googleapis.com/v1/projects/PROJECT_ID /instances/INSTANCE_ID /getDiskShrinkConfig
요청을 보내려면 다음 옵션 중 하나를 펼칩니다.
cURL(Linux, macOS, Cloud Shell)
다음 명령어를 실행합니다.
curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://sqladmin.googleapis.com/v1/projects/PROJECT_ID /instances/INSTANCE_ID /getDiskShrinkConfig"
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 /instances/INSTANCE_ID /getDiskShrinkConfig" | Select-Object -Expand Content
다음과 비슷한 JSON 응답이 표시됩니다.
응답
{
"kind": "sql#instance",
"min_target_size_gb": "1234"
"message": "The size of your instance's storage impacts IOPS, and therefore shrinking your storage
may have a negative impact on IOPS. Before shrinking your storage, please refer to our
documentation on Cloud SQL limits to understand what impact shrinking your storage might have:
https://cloud.google.com/sql/docs/quotas#fixed-limits. Additionally, we recommend leaving an
appropriate buffer for operational purposes, like reindexing, etc. We recommend a buffer of at
least 100 GB or 20% more than current usage, whichever is larger. For more details, please refer
to: https://cloud.google.com/sql/docs/shared-responsibility. The estimated operation time is
20 minutes."
}
응답에는 min_target_size_gb 값이 포함됩니다. 이 값을 사용하여 스토리지 축소 작업을 실행할 때 --storage-size 매개변수에 사용할 값을 확인할 수 있습니다.
또한 응답은 다음과 비슷한 예상 작업 시간이 포함된 메시지를 반환합니다.
...
"The estimated operation time is 20 minutes".
REST v1beta4 GET 메서드를 사용하여 인스턴스의 타겟 최소 스토리지 용량을 확인합니다.
요청 데이터를 사용하기 전에 다음을 바꿉니다.
PROJECT_ID : 기본 인스턴스가 있는 프로젝트의 이름
INSTANCE_ID : 기본 인스턴스의 인스턴스 ID입니다.
HTTP 메서드 및 URL:
GET https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID /instances/INSTANCE_ID /getDiskShrinkConfig
요청을 보내려면 다음 옵션 중 하나를 펼칩니다.
cURL(Linux, macOS, Cloud Shell)
다음 명령어를 실행합니다.
curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID /instances/INSTANCE_ID /getDiskShrinkConfig"
PowerShell(Windows)
다음 명령어를 실행합니다.
$cred = gcloud auth print-access-token $headers = @{ "Authorization" = "Bearer $cred" } Invoke-WebRequest ` -Method GET ` -Headers $headers ` -Uri "https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID /instances/INSTANCE_ID /getDiskShrinkConfig" | Select-Object -Expand Content
다음과 비슷한 JSON 응답이 표시됩니다.
응답
{
"kind": "sql#instance",
"min_target_size_gb": "1234"
"message": "The size of your instance's storage impacts IOPS, and therefore shrinking your storage
may have a negative impact on IOPS. Before shrinking your storage, please refer to our
documentation on Cloud SQL limits to understand what impact shrinking your storage might have:
https://cloud.google.com/sql/docs/quotas#fixed-limits. Additionally, we recommend leaving an
appropriate buffer for operational purposes, like reindexing, etc. We recommend a buffer of at
least 100 GB or 20% more than current usage, whichever is larger. For more details, please refer
to: https://cloud.google.com/sql/docs/shared-responsibility. The estimated operation time is
20 minutes."
}
응답에는 min_target_size_gb 값이 포함됩니다. 이 값을 사용하여 스토리지 축소 작업을 실행할 때 --storage-size 매개변수에 사용할 값을 확인할 수 있습니다.
또한 응답은 다음과 비슷한 예상 작업 시간이 포함된 메시지를 반환합니다.
...
"The estimated operation time is 20 minutes".
인스턴스의 스토리지 용량을 축소합니다.
gcloud 다음 명령어를 실행하여 인스턴스의 스토리지를 축소합니다.
gcloud sql instances perform-storage-shrink INSTANCE_NAME \
--storage-size= TARGET_STORAGE_SIZE --async
다음을 바꿉니다.
INSTANCE_NAME : 인스턴스 이름입니다.
TARGET_STORAGE_SIZE : 타겟 스토리지 용량(GB)입니다. 예를 들어 100GB입니다.
--async 플래그를 사용하여 비동기적으로 작업을 기다리는 것이 좋습니다.
REST v1
요청 데이터를 사용하기 전에 다음을 바꿉니다.
PROJECT_ID : 인스턴스가 있는 프로젝트의 ID입니다.
INSTANCE_ID : 인스턴스의 ID입니다.
TARGET_STORAGE_SIZE : 대상 스토리지 크기(GB)입니다.
HTTP 메서드 및 URL:
POST https://sqladmin.googleapis.com/v1/projects/PROJECT_ID /instances/INSTANCE_ID /performDiskShrink
JSON 요청 본문:
{
"targetSizeGb": TARGET_STORAGE_SIZE
}
요청을 보내려면 다음 옵션 중 하나를 펼칩니다.
cURL(Linux, macOS, Cloud Shell)
요청 본문을 request.json 파일에 저장하고 다음 명령어를 실행합니다.
curl -X POST \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json; charset=utf-8" \ -d @request.json \ "https://sqladmin.googleapis.com/v1/projects/PROJECT_ID /instances/INSTANCE_ID /performDiskShrink"
PowerShell(Windows)
요청 본문을 request.json 파일에 저장하고 다음 명령어를 실행합니다.
$cred = gcloud auth print-access-token $headers = @{ "Authorization" = "Bearer $cred" } Invoke-WebRequest ` -Method POST ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -InFile request.json ` -Uri "https://sqladmin.googleapis.com/v1/projects/PROJECT_ID /instances/INSTANCE_ID /performDiskShrink" | Select-Object -Expand Content
다음과 비슷한 JSON 응답이 표시됩니다.
응답
{
"kind": "sql#operation",
"targetLink": "https://sqladmin.googleapis.com/v1/projects/PROJECT_ID /instances/INSTANCE_ID ",
"status": "PENDING",
"user": "user@example.com",
"insertTime": "2019-09-25T22:19:33.735Z",
"operationType": "UPDATE",
"name": "operation-id",
"targetId": "INSTANCE_ID ",
"selfLink": "https://sqladmin.googleapis.com/v1/projects/PROJECT_ID /operations/operation-id",
"targetProject": "PROJECT_ID "
}
REST v1beta4
요청 데이터를 사용하기 전에 다음을 바꿉니다.
PROJECT_ID : 인스턴스가 있는 프로젝트의 ID입니다.
INSTANCE_ID : 인스턴스의 ID입니다.
TARGET_STORAGE_SIZE : 인스턴스의 대상 스토리지 크기입니다.
HTTP 메서드 및 URL:
POST https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID /instances/INSTANCE_ID /performDiskShrink
JSON 요청 본문:
{
"targetSizeGb": TARGET_STORAGE_SIZE
}
요청을 보내려면 다음 옵션 중 하나를 펼칩니다.
cURL(Linux, macOS, Cloud Shell)
요청 본문을 request.json 파일에 저장하고 다음 명령어를 실행합니다.
curl -X POST \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json; charset=utf-8" \ -d @request.json \ "https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID /instances/INSTANCE_ID /performDiskShrink"
PowerShell(Windows)
요청 본문을 request.json 파일에 저장하고 다음 명령어를 실행합니다.
$cred = gcloud auth print-access-token $headers = @{ "Authorization" = "Bearer $cred" } Invoke-WebRequest ` -Method POST ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -InFile request.json ` -Uri "https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID /instances/INSTANCE_ID /performDiskShrink" | Select-Object -Expand Content
다음과 비슷한 JSON 응답이 표시됩니다.
응답
{
"kind": "sql#operation",
"targetLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID /instances/INSTANCE_ID ",
"status": "PENDING",
"user": "user@example.com",
"insertTime": "2019-09-25T22:19:33.735Z",
"operationType": "UPDATE",
"name": "operation-id",
"targetId": "INSTANCE_ID ",
"selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID /operations/operation-id",
"targetProject": "PROJECT_ID "
}
스토리지 축소 작업의 상태를 확인하려면 작업 상태 확인 을 참고하세요.
스토리지 축소 작업 취소
스토리지 축소 작업 ID를 가져옵니다.
다음 list 명령어를 실행하여 작업 ID를 가져올 수 있습니다.
gcloud sql operations list
취소 요청을 보냅니다.
gcloud 다음 명령어를 실행하여 요청을 취소합니다.
gcloud sql operations cancel OPERATION_ID
다음을 바꿉니다.
OPERATION_ID : 취소할 스토리지 축소 작업의 ID입니다.
REST v1
요청 데이터를 사용하기 전에 다음을 바꿉니다.
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
성공 상태 코드(2xx)와 빈 응답을 받게 됩니다.
REST v1beta4
요청 데이터를 사용하기 전에 다음을 바꿉니다.
PROJECT_ID : 인스턴스가 있는 프로젝트의 ID입니다.
OPERATION_ID : 취소할 스토리지 축소 작업의 ID입니다.
HTTP 메서드 및 URL:
POST https://sqladmin.googleapis.com/sql/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/sql/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/sql/v1beta4/projects/PROJECT_ID /operations/OPERATION_ID /cancel" | Select-Object -Expand Content
성공 상태 코드(2xx)와 빈 응답을 받게 됩니다.
취소 요청 또는 기타 작업의 상태 확인
요청 상태를 확인하려면 다음 명령어를 실행하세요.
gcloud
취소 요청의 작업 ID를 가져옵니다.
gcloud sql operations list
작업 상태를 확인합니다.
gcloud sql operations describe OPERATION_ID
다음을 바꿉니다.
OPERATION_ID : 확인할 작업의 ID입니다.
REST v1
요청 데이터를 사용하기 전에 다음을 바꿉니다.
PROJECT_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 /instances/INSTANCE_ID ",
"status": "RUNNING",
"user": "user@example.com",
"insertTime": "2023-12-18T22:43:09.849Z",
"startTime": "2023-12-18T22:43:10.373Z",
"operationType": "UPDATE",
"name": "OPERATION_ID",
"targetId": "example_instance",
"selfLink": "https://sqladmin.googleapis.com/v1/projects/PROJECT_ID /operations/OPERATION_ID ",
"targetProject": "PROJECT_ID"
}
REST v1beta4
요청 데이터를 사용하기 전에 다음을 바꿉니다.
PROJECT_ID : 인스턴스가 있는 프로젝트의 이름입니다.
OPERATION_ID : 스토리지 축소 작업의 ID입니다.
HTTP 메서드 및 URL:
GET https://sqladmin.googleapis.com/sql/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/sql/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/sql/v1beta4/projects/PROJECT_ID /operations/OPERATION_ID " | Select-Object -Expand Content
다음과 비슷한 JSON 응답이 표시됩니다.
응답
{
"kind": "sql#operation",
"targetLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID /instances/INSTANCE_ID ",
"status": "RUNNING",
"user": "user@example.com",
"insertTime": "2023-12-18T22:43:09.849Z",
"startTime": "2023-12-18T22:43:10.373Z",
"operationType": "UPDATE",
"name": "OPERATION_ID",
"targetId": "example_instance",
"selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID /operations/OPERATION_ID ",
"targetProject": "PROJECT_ID"
}
문제 해결
문제 해결에 대한 자세한 내용은 스토리지 용량 업데이트 문제 를 참고하세요.
다음 단계
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스 에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스 에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책 을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2026-03-31(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2026-03-31(UTC)"],[],[]]