GCP

Setting up a GCP CloudSQL maintenance window

misankim 2023. 5. 12. 23:41

Setting up a GCP CloudSQL maintenance window

 

Maintenance information for Cloud SQL instances

https://cloud.google.com/sql/docs/mysql/maintenance?hl=ko

 

Check and set maintenance windows

https://cloud.google.com/sql/docs/mysql/set-maintenance-window?hl=ko

 

Self-service maintenance

https://cloud.google.com/sql/docs/mysql/self-service-maintenance?hl=ko

 

(memorystore redis) maintenance policy

https://cloud.google.com/memorystore/docs/redis/maintenance-policy?hl=ko

 

(memorystore redis) Check and set maintenance window

https://cloud.google.com/memorystore/docs/redis/finding-and-setting-maintenance-windows?hl=ko

 

 

# Check current settings

 

gcloud sql instances describe premisan-test --project=my-project

 

Check maintenanceWindow in output

 

backendType: SECOND_GEN
connectionName: my-project:asia-northeast3:premisan-test
createTime: '2022-09-23T02:09:33.154Z'
databaseInstalledVersion: MYSQL_8_0_26
databaseVersion: MYSQL_8_0
etag: 00003fbc25b970180000ebb3b8af0000b3b1a6a000014bcd000006c4450000
gceZone: asia-northeast3-b
instanceType: CLOUD_SQL_INSTANCE
ipAddresses:
- ipAddress: 34.123.123.123
  type: PRIMARY
- ipAddress: 10.0.0.3
  type: PRIVATE
kind: sql#instance
maintenanceVersion: MYSQL_8_0_26.R20221108.00_02
name: premisan-test
project: my-project
region: asia-northeast3
selfLink: https://sqladmin.googleapis.com/sql/v1beta4/projects/my-project/instances/premisan-test
...
  maintenanceWindow:
    day: 0
    hour: 0
    kind: sql#maintenanceWindow
    updateTrack: stable
...

 

 

# maintenanceWindow settings

 

gcloud sql instances patch premisan-test --maintenance-window-day=SUN --maintenance-window-hour=17 --project=my-project

 

Output

{"name": "premisan-test", "project": "my-project", "settings": {"maintenanceWindow": {"day": 7, "hour": 17}}}
Patching Cloud SQL instance...done.
Updated [https://sqladmin.googleapis.com/sql/v1beta4/projects/my-project/instances/premisan-test].

 

 

# Self-service maintenance

 

gcloud sql instances describe premisan-test --project=my-project

 

maintenanceVersion value is the current version

 

The availableMaintenanceVersions value is shown if there are maintenance versions available.

-> Update an instance by setting the value of the --maintenance-version option to the value of availableMaintenanceVersions

-> Service interruption occurs

 

gcloud sql instances patch premisan-test \
--maintenance-version=MYSQL_8_0_26.R20221108.00_02 \
--project=my-project

 

(참고) If you do not set a cloudsql instance maintenance window, no notification will be sent even if you set up email notifications for the maintenance window