Finding and setting maintenance windows

This page has procedures for finding and setting maintenance windows for Cloud SQL instances. To learn more about how and why Cloud SQL performs maintenance, see the Overview of maintenance on Cloud SQL instances.

Before you begin

  1. Sign in to your Google Account.

    If you don't already have one, sign up for a new account.

  2. In the Cloud Console, on the project selector page, select or create a Cloud project.

    Go to the project selector page

  3. Projeniz için faturalandırmanın etkinleştirildiğinden emin olun.

    Faturalandırmayı etkinleştirmeyi öğren

  4. Install and initialize the Cloud SDK.

Setting a preferred window for maintenance on an instance

To set a preferred maintenance window:

Console

  1. Go to the Instances page.

    GO TO THE INSTANCES PAGE

  2. Click an Instance name.
  3. On the Cloud SQL instance Overview page, click Edit maintenance preferences.
  4. Under Configuration options, open Maintenance.
  5. Configure the following options:
    • Preferred window. Set the day and hour range when updates can occur on this instance.
    • Order of update. Set the order for updating this instance, in relation to updates to other instances. Set timing to Any, Earlier, or Later. Earlier instances receive updates up to a week earlier than later instances within the same location.

gcloud

Before using the gcloud command below, make the following replacements:
  • instance-id: Instance to reschedule
  • day: Day when you want maintenance to occur. Set to one of SUN, MON, TUE, WED, THU, FRI, SAT.
  • hour: Hour of day for maintenance window, in UTC time zone (1-24).
    gcloud sql instances patch instance-id
        --maintenance-window-day=day
        --maintenance-window-hour=hour
    
For reference information, see gcloud sql instances patch.

Opting in to maintenance notifications

  1. Go to the Communication page.
    GO TO THE COMMUNICATION PAGE
  2. In the row for Cloud SQL, Maintenance window, select the radio button under Email to turn it ON.
  3. You must also set a preferred window for maintenance on an instance to receive maintenance notifications for that instance.

Finding maintenance notifications in the Cloud Console

You can view maintenance notifications in a few places in the Cloud Console:

  • On the ACTIVITY dashboard, look for instances marked with SQL Maintenance.
    GO TO THE ACTIVITY PAGE

  • When an instance is scheduled for maintenance, the date for maintenance is listed on the Instances page in the Maintenance column. The Maintenance column is usually hidden, but it displays automatically when maintenance is scheduled. You can also select Maintenance from the Column display options (Column display options icon is three lines) if you want the Maintenance column to always show up.

  • Alternatively, you can select an instance to go to the Instance details page. If the instance is scheduled for maintenance, you will see a message in the Maintenance pane.
    GO TO THE INSTANCES PAGE

Rescheduling planned maintenance

To reschedule planned maintenance:

Console

  1. Go to the Instances page.

    GO TO THE INSTANCES PAGE

  2. Search for the instances you want to reschedule using name, IP, location, or custom labels.
  3. Select one or more Cloud SQL instances.
  4. In the Maintenance tab on the INFO PANEL, select reschedule.
  5. Choose whether to apply maintenance immediately, reschedule it to happen one week from the originally scheduled time, or create another scheduled time.

gcloud

Before using the gcloud command below, make the following replacements:
  • instance-id: The instance to reschedule
  • reschedule-type: Use one of IMMEDIATE, NEXT_AVAILABLE_WINDOW, or SPECIFIC_TIME
  • reschedule-time: If you select SPECIFIC_TIME for reschedule-type, you also need to set this flag to specify the new day and time for maintenance to occur. Uses ISO 8601 format. For example, 2020-01-16T16:56:00.000Z
  gcloud sql reschedule-maintenance instance-id
      --reschedule-type=reschedule-type
      [--schedule-time=reschedule-time]
  
For reference information, see gcloud sql reschedule-maintenance.

REST

Before using any of the request data below, make the following replacements:

  • project-id: The project ID
  • instance-id: The instance ID
  • reschedule-type: Use one of IMMEDIATE, NEXT_AVAILABLE_WINDOW, or SPECIFIC_TIME

HTTP method and URL:

POST https://www.googleapis.com/sql/v1beta4/projects/project-id/instances/instance-id/rescheduleMaintenance

Request JSON body:

{
  "reschedule": {
    "reschedule_type": "reschedule-type"
  }
}

To send your request, expand one of these options:

You should receive a JSON response similar to the following:

{
  "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",
  "startTime": "08:00",
  "endTime": "08:01",
  "operationType": RESCHEDULE_MAINTENANCE,
  "name": "operation-id",
  "targetId": "instance-id",
  "selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/project-id/operations/operation-id",
  "targetProject": "project-id"
}
To see how the underlying REST API request is constructed for this task, see the APIs Explorer on the instances:post page.

What's next