- HTTP request
- Path parameters
- Request body
- Response body
- Authorization Scopes
- InstancesDemoteMasterRequest
- DemoteMasterContext
- DemoteMasterConfiguration
- DemoteMasterMySqlReplicaConfiguration
- Examples
- Try it!
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 |
ID of the project that contains the instance. |
instance |
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 master request.
JSON representation | |
---|---|
{
"demoteMasterContext": {
object ( |
Fields | |
---|---|
demoteMasterContext |
Contains details about the demoteMaster operation. |
DemoteMasterContext
Database instance demote master context.
JSON representation | |
---|---|
{
"kind": string,
"verifyGtidConsistency": boolean,
"masterInstanceName": string,
"replicaConfiguration": {
object ( |
Fields | |
---|---|
kind |
This is always sql#demoteMasterContext. |
verifyGtidConsistency |
Verify GTID consistency for demote operation. Default value: True. Second Generation instances only. Setting this flag to false enables you to bypass GTID consistency check between on-premises master 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 |
The name of the instance which will act as on-premises master in the replication setup. |
replicaConfiguration |
Configuration specific to read-replicas replicating from the on-premises master. |
DemoteMasterConfiguration
Read-replica configuration for connecting to the on-premises master.
JSON representation | |
---|---|
{
"kind": string,
"mysqlReplicaConfiguration": {
object ( |
Fields | |
---|---|
kind |
This is always sql#demoteMasterConfiguration. |
mysqlReplicaConfiguration |
MySQL specific configuration when replicating from a MySQL on-premises master. 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 |
This is always sql#demoteMasterMysqlReplicaConfiguration. |
username |
The username for the replication connection. |
password |
The password for the replication connection. |
clientKey |
PEM representation of the slave's private key. The corresponsing public key is encoded in the client's certificate. The format of the slave's private key can be either PKCS #1 or PKCS #8. |
clientCertificate |
PEM representation of the slave's x509 certificate. |
caCertificate |
PEM representation of the trusted CA's x509 certificate. |