Updated on 2024-03-27 GMT+08:00

Performing Primary/Standby Switchovers in Batches

Function

This API is used to perform primary/standby switchovers in batches.

Debugging

You can debug the API in API Explorer to support automatic authentication. API Explorer can automatically generate and debug example SDK code.

Constraints

This API only applies to tasks in the Disaster recovery in progress or Disaster recovery failed status. A switchover can be performed when the DR database can be properly connected. Dual-active DR does not support the switchover.

URI

POST /v3/{project_id}/jobs/batch-switchover

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID of a tenant in a region

For details about how to obtain the project ID, see Obtaining a Project ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

The content type.

The default value is application/json.

X-Auth-Token

Yes

String

User token obtained from IAM.

X-Language

No

String

Request language type

Default value: en-us

Values:

  • en-us
  • zh-cn
Table 3 Request body parameters

Parameter

Mandatory

Type

Description

jobs

Yes

Array of strings

IDs of batch primary/standby switchover tasks.

Response Parameters

Status code: 202

Table 4 Response body parameters

Parameter

Type

Description

results

Array of objects

Returned of batch primary/standby switchover tasks.

For details, see Table 5.

count

Integer

Total number.

Table 5 Data structure description of field results

Parameter

Type

Description

job_id

String

Task ID.

updated_at

String

Update time, in the format yyyy-MM-dd'T'HH:mm:ss'Z'.

source_db

Object

Source database.

For details, see Table 6.

target_db

Object

Destination database.

For details, see Table 6.

job_direction

String

Task direction. Values:

  • up: The current cloud is the standby cloud in the DR and to-the-cloud scenarios.
  • down: The current cloud is the active cloud in the DR and out-of-cloud scenarios.
  • non-dbs: self-built databases.

is_target_readonly

Boolean

Whether the destination database is read-only.

error_msg

String

Error message

error_code

String

Error code

Table 6 Data structure description of fields source_db and target_db

Parameter

Type

Description

id

String

Database ID.

obj_id

String

Object ID

instance_name

String

Name of the RDS DB instance.

db_type

String

Database type. Values:

  • mysql
  • mongodb

db_user

String

Database user.

db_password

String

Database password.

manage_ip

String

Management IP address.

traffic_ip

String

Traffic IP address.

db_port

Integer

Database port.

region

String

Region where the RDS DB instance is located.

created_at

String

Creation date, in the format yyyy-MM-dd'T'HH:mm:ss'Z'.

updated_at

String

Modification date, in the format yyyy-MM-dd'T'HH:mm:ss'Z'.

ip

String

Private IP address of the replication instance.

public_ip

String

EIP of the replication instance.

az_code

String

AZ code.

security_group_id

String

ID of the security group to which the source database belongs.

subnet_id

String

ID of the subnet where the source database is located.

vpc_id

String

ID of the VPC where the source database is located.

volume_size

Long

Storage space of a replication instance.

full_trans_user_pwd

String

Ciphertext password of the user for full migration.

increment_trans_user_pwd

String

Ciphertext password of the incremental migration user.

ssl_link

Boolean

Whether SSL is enabled.

ssl_cert_key

String

SSL certificate content.

ssl_cert_name

String

SSL certificate name.

ssl_cert_check_sum

String

Checksum value of the SSL certificate content.

ssl_cert_password

String

SSL certificate password, in ciphertext.

db_version

String

Database version.

mongo_ha_mode

String

Mongo HA mode. Values:

  • Sharding: cluster.
  • ReplicaSet: replica set.
  • ReplicaSingle: single node.

project_id

String

Project ID of an RDS DB instance.

cluster_mode

String

Cluster mode. Values:

  • Single: single-node RDS.
  • Ha: primary and standby RDS.
  • GR: RDS Finance Edition.
  • Sharding: MongoDB cluster or DDM mode. The default value is Sharding.
  • ReplicaSet: MongoDB replica set.
  • Replica: RDS read replica.
  • ReplicaSingle: MongoDB single node.
  • Cluster: cluster.
  • Independent: GaussDB independent mode.
  • Combined: GaussDB combined mode.
  • Distributed: GaussDB(for MySQL) distributed.

instance_id

String

RDS DB instance ID.

db_name

String

Oracle service name.

topic

String

Name of the mrskafka topic.

safe_mode

Integer

Whether to enable Kerberos authentication for MRSKafka. Values:

  • 0: non-security authentication.
  • 1: security authentication.

kerberos_vo

Object

Information required for Kerberos authentication.

For details, see Table 7.

multi_write_db_id

String

ID of the multi-write database.

Table 7 Data structure description of field kerberos_vo

Parameter

Type

Description

krb5_conf_file

String

krb5 configuration file.

key_tab_file

String

Key file.

domain_name

String

Domain name.

user_principal

String

Kerberos user object.

Example Request

Performing primary/standby switchovers in batches

https://{endpoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-switchover

{
  "jobs" : [ "8d0e8e36-a618-490d-8a46-8c61ac9jb502" ]
}

Example Response

Status code: 202

Accepted

{
  "count" : 1,
  "results" : [ {
    "job_id" : "8d0e8e36-a618-490d-8a46-8c61ac9jb502",
    "updated_at" : "2020-12-18T06:38:37Z",
    "source_db" : {
      "id" : "2706a49b-6dd0-4b70-b2a8-36cf0034703d",
      "region" : "cn-xianhz-1",
      "ip" : "192.168.1.144",
      "topic" : null,
      "obj_id" : "0b51710fd4e54d6bb90ab91bf68f86efno01",
      "instance_name" : "rds-zw-source",
      "db_type" : "mysql",
      "db_user" : "root",
      "db_password" : "********",
      "manage_ip" : null,
      "traffic_ip" : "192.168.1.144",
      "db_port" : 3306,
      "created_at" : "2020-12-16T12:09:54Z",
      "updated_at" : "2020-12-18T06:33:09Z",
      "public_ip" : null,
      "az_code" : "az3xahz",
      "security_group_id" : "652cbe2d-d487-407e-b666-d01948b33879",
      "subnet_id" : "c6f66ccb-be7a-499e-aa8a-1389355e67a8",
      "vpc_id" : "7c73a425-885b-4e54-a0e6-ef9ee271a1db",
      "volume_size" : null,
      "full_trans_user_pwd" : "******",
      "increment_trans_user_pwd" : "******",
      "ssl_link" : false,
      "ssl_cert_key" : null,
      "ssl_cert_name" : null,
      "ssl_cert_check_sum" : null,
      "ssl_cert_password" : null,
      "db_version" : "5.7.31",
      "mongo_ha_mode" : null,
      "project_id" : "054ba152d480d55b2f5dc0069e7ddef0",
      "cluster_mode" : "Single",
      "instance_id" : "3efbb0f1241f429e8e1d8f99ab094c7ain01",
      "db_name" : null,
      "safe_mode" : null,
      "kerberos_vo" : null,
      "multi_write_db_id" : null
    },
    "target_db" : {
      "id" : "81ca3c57-029b-4a37-8f2d-2ee5f128ef9d",
      "region" : "cn-xianhz-1",
      "ip" : "192.168.1.60",
      "topic" : null,
      "obj_id" : "b46e908dbbb44bb3b17f0a75c908d1d7no01",
      "instance_name" : "rds-zw-target",
      "db_type" : "mysql",
      "db_user" : "root",
      "db_password" : "********",
      "manage_ip" : null,
      "traffic_ip" : "192.168.1.60",
      "db_port" : 3306,
      "created_at" : "2020-12-16T12:09:55Z",
      "updated_at" : "2020-12-18T06:33:08Z",
      "public_ip" : null,
      "az_code" : "az3xahz",
      "security_group_id" : "652cbe2d-d487-407e-b666-d01948b33879",
      "subnet_id" : "c6f66ccb-be7a-499e-aa8a-1389355e67a8",
      "vpc_id" : "7c73a425-885b-4e54-a0e6-ef9ee271a1db",
      "volume_size" : 40,
      "full_trans_user_pwd" : "******",
      "increment_trans_user_pwd" : "******",
      "ssl_link" : false,
      "ssl_cert_key" : null,
      "ssl_cert_name" : null,
      "ssl_cert_check_sum" : null,
      "ssl_cert_password" : null,
      "db_version" : "5.7.31",
      "mongo_ha_mode" : null,
      "project_id" : "054ba152d480d55b2f5dc0069e7ddef0",
      "cluster_mode" : "Single",
      "instance_id" : "a3ab61173b1b4533b8c3dfc2bb3ec828in01",
      "db_name" : null,
      "safe_mode" : null,
      "kerberos_vo" : null,
      "multi_write_db_id" : null
    },
    "job_direction" : "down",
    "is_target_readonly" : false
  } ]
}

Status Code

Status Code

Description

202

Accepted

400

Bad Request

Error Code

For details, see Error Code.