Method: instances.demoteMaster

Demotes the stand-alone instance to be a Cloud SQL read replica for an external database server.

HTTP request

POST https://sqladmin.googleapis.com/sql/v1beta4/projects/{project}/instances/{instance}/demoteMaster

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
project

string

ID of the project that contains the instance.

instance

string

Cloud SQL instance name.

Request body

The request body contains an instance of InstancesDemoteMasterRequest.

Response body

If successful, the response body contains an instance of Operation.

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/sqlservice.admin

For more information, see the Authentication Overview.

InstancesDemoteMasterRequest

Database demote primary instance request.

JSON representation
{
  "demoteMasterContext": {
    object (DemoteMasterContext)
  }
}
Fields
demoteMasterContext

object (DemoteMasterContext)

Contains details about the demoteMaster operation.

DemoteMasterContext

Database instance demote primary instance context.

JSON representation
{
  "kind": string,
  "verifyGtidConsistency": boolean,
  "masterInstanceName": string,
  "replicaConfiguration": {
    object (DemoteMasterConfiguration)
  },
  "skipReplicationSetup": boolean
}
Fields
kind

string

This is always sql#demoteMasterContext.

verifyGtidConsistency

boolean

Verify the GTID consistency for demote operation. Default value: True. Setting this flag to false enables you to bypass the GTID consistency check between on-premises primary instance and Cloud SQL instance during the demotion operation but also exposes you to the risk of future replication failures. Change the value only if you know the reason for the GTID divergence and are confident that doing so will not cause any replication issues.

masterInstanceName

string

The name of the instance which will act as on-premises primary instance in the replication setup.

replicaConfiguration

object (DemoteMasterConfiguration)

Configuration specific to read-replicas replicating from the on-premises primary instance.

skipReplicationSetup

boolean

Flag to skip replication setup on the instance.

DemoteMasterConfiguration

Read-replica configuration for connecting to the on-premises primary instance.

JSON representation
{
  "kind": string,
  "mysqlReplicaConfiguration": {
    object (DemoteMasterMySqlReplicaConfiguration)
  }
}
Fields
kind

string

This is always sql#demoteMasterConfiguration.

mysqlReplicaConfiguration

object (DemoteMasterMySqlReplicaConfiguration)

MySQL specific configuration when replicating from a MySQL on-premises primary instance. Replication configuration information such as the username, password, certificates, and keys are not stored in the instance metadata. The configuration information is used only to set up the replication connection and is stored by MySQL in a file named master.info in the data directory.

DemoteMasterMySqlReplicaConfiguration

Read-replica configuration specific to MySQL databases.

JSON representation
{
  "kind": string,
  "username": string,
  "password": string,
  "clientKey": string,
  "clientCertificate": string,
  "caCertificate": string
}
Fields
kind

string

This is always sql#demoteMasterMysqlReplicaConfiguration.

username

string

The username for the replication connection.

password

string

The password for the replication connection.

clientKey

string

PEM representation of the replica's private key. The corresponsing public key is encoded in the client's certificate. The format of the replica's private key can be either PKCS #1 or PKCS #8.

clientCertificate

string

PEM representation of the replica's x509 certificate.

caCertificate

string

PEM representation of the trusted CA's x509 certificate.