インスタンスの編集
このページでは、既存の Cloud SQL インスタンスを編集する方法について説明します。
インスタンスの作成後、そのインスタンスの実行中に編集して設定を変更できます。インスタンスの設定と、設定の変更によるインスタンスへの影響については、インスタンスの設定をご覧ください。
インスタンスを編集する
ほとんどの編集は、実行中のインスタンスにのみ適用できます。
コンソール
-
Google Cloud コンソールで Cloud SQL の [インスタンス] ページに移動します。
Cloud SQL の [インスタンス] に移動
-
インスタンスの [概要] ページを開くには、インスタンス名をクリックします。
- [編集] をクリックします。
- [構成オプション] セクションで、インスタンスの編集可能な設定を更新します。
詳しくは、インスタンスの設定をご覧ください。
- [保存] をクリックして変更を適用します。
gcloud
次のコマンドでは、バックアップの開始時刻が変更されます。
gcloud sql instances patch INSTANCE_NAME \
--backup-start-time 16:00
再起動が必要な値を変更した場合、変更の続行またはキャンセルの選択を求められます。
REST v1
次のコマンドでは、バックアップの開始時刻が変更されます。
リクエストのデータを使用する前に、次のように置き換えます。
- project-id: プロジェクト ID
- instance-id: インスタンス ID
HTTP メソッドと URL:
PATCH https://sqladmin.googleapis.com/v1/projects/project-id/instances/instance-id
JSON 本文のリクエスト:
{
"settings": {
"backupConfiguration": {
"startTime": "16:00",
"enabled": true,
"binaryLogEnabled": true
}
}
}
リクエストを送信するには、次のいずれかのオプションを展開します。
curl(Linux、macOS、Cloud Shell)
リクエスト本文を request.json
という名前のファイルに保存して、次のコマンドを実行します。
curl -X PATCH \
-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"
PowerShell(Windows)
リクエスト本文を request.json
という名前のファイルに保存して、次のコマンドを実行します。
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method PATCH `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://sqladmin.googleapis.com/v1/projects/project-id/instances/instance-id" | 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": "2020-01-16T02:32:12.281Z",
"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
HTTP メソッドと URL:
PATCH https://sqladmin.googleapis.com/sql/v1beta4/projects/project-id/instances/instance-id
JSON 本文のリクエスト:
{
"settings": {
"backupConfiguration": {
"startTime": "16:00",
"enabled": true,
"binaryLogEnabled": true
}
}
}
リクエストを送信するには、次のいずれかのオプションを展開します。
curl(Linux、macOS、Cloud Shell)
リクエスト本文を request.json
という名前のファイルに保存して、次のコマンドを実行します。
curl -X PATCH \
-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"
PowerShell(Windows)
リクエスト本文を request.json
という名前のファイルに保存して、次のコマンドを実行します。
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method PATCH `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://sqladmin.googleapis.com/sql/v1beta4/projects/project-id/instances/instance-id" | 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": "2020-01-16T02:32:12.281Z",
"operationType": "UPDATE",
"name": "operation-id",
"targetId": "instance-id",
"selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/project-id/operations/operation-id",
"targetProject": "project-id"
}
再起動が必要な値を変更した場合、変更の続行またはキャンセルの選択を求められます。
このタスクで
基礎となる REST API リクエストがどのように作成されるかについては、
API Explorer の Instances: patch ページをご覧ください。
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2022-06-24 UTC.
[{
"type": "thumb-down",
"id": "hardToUnderstand",
"label":"わかりにくい"
},{
"type": "thumb-down",
"id": "incorrectInformationOrSampleCode",
"label":"情報またはサンプルコードが不正確"
},{
"type": "thumb-down",
"id": "missingTheInformationSamplesINeed",
"label":"必要な情報 / サンプルがない"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"翻訳に関する問題"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"その他"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"わかりやすい"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"問題の解決に役立った"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"その他"
}]