You can call the MigrateDBInstance operation to migrate an instance across hosts in a dedicated cluster.

Dedicated clusters allow you to manage a number of instances at a time. You can create multiple dedicated clusters in a single region. Each dedicated cluster consists of multiple hosts. You can create multiple instances on each host. For more information, see What is ApsaraDB MyBase?

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes Migrate instance

The operation that you want to perform. Set the value to MigrateDBInstance.

DBInstanceId String Yes rm-uf6wjk5xxxxxxx

The ID of the instance.

DedicatedHostGroupId String Yes dhg-4nxxxxxxx

The ID of the dedicated cluster. You can call the DescribeDedicatedHostGroups operation to query the IDs of dedicated clusters.

TargetDedicatedHostIdForMaster String Yes i-bpxxxxxxx1

The ID of the host to which you want to migrate the primary instance. You can call the DescribeDedicatedHosts operation to query the IDs of hosts.

TargetDedicatedHostIdForSlave String Yes i-bpxxxxxxx2

The ID of the host to which you want to migrate the secondary instance. You can call the DescribeDedicatedHosts operation to query the IDs of hosts.

RegionId String No cn-hangzhou

The region ID of the instance. You can call the DescribeRegions operation to query the most recent region list.

EffectiveTime String No MaintainTime

The time when you want the system to start the migration. Valid values:

  • Immediately: The system immediately starts the migration. This is the default value.
  • MaintainTime: The system starts the migration during the specified maintenance window.
  • Specified: The system starts the migration at the specified point in time.
SpecifiedTime String No 2019-10-21T10:00:00Z

The point in time when you want the system to start the migration. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

Note This parameter must be specified when you set the EffectiveTime parameter to Specified.
ZoneIdForLog String No cn-hangzhou-i

The zone ID of the logger instance.

ZoneIdForFollower String No cn-hangzhou-h

The zone ID of the secondary instance.

Response parameters

Parameter Type Example Description
MigrationId Integer 2245016

The serial number of the task in the migration task queue. When the serial number becomes 0, the system starts the migration.

RequestId String 498AE8CA-8C81-4A01-AF37-2B902014ED30

The ID of the request.

TaskId Integer 108246861

The ID of the task.

Examples

Sample requests

http(s)://rds.aliyuncs.com/?Action=MigrateDBInstance
&DBInstanceId=rm-uf6wjk5xxxxxxx
&DedicatedHostGroupId=dhg-4nxxxxxxx
&TargetDedicatedHostIdForMaster=i-bpxxxxxxx1
&TargetDedicatedHostIdForSlave=i-bpxxxxxxx2
&<Common request parameters>

Sample success responses

XML format

<MigrateDBInstanceResponse>
  <MigrationId>2245016</MigrationId>
  <RequestId>498AE8CA-8C81-4A01-AF37-2B902014ED30</RequestId>
  <TaskId>108246861</TaskId>
</MigrateDBInstanceResponse>

JSON format

{
    "MigrationId":2245016,
    "RequestId":"498AE8CA-8C81-4A01-AF37-2B902014ED30",
    "TaskId":108246861
}

Error codes

HTTP status code Error code Error message Description
400 InvalidTargetDedicatedHostId.NotFound The target dedicated host ID is invalid. The error message returned because the specified host ID is invalid.
400 InvalidMasterHostName The specified master host zoneId is different from the master zoneId. The error message returned because the zone ID of the host is inconsistent with the ID of the primary zone.
404 InsufficientResourceCapacity No host is available for the requested instance. The error message returned because no suitable hosts can be found due to insufficient resources in the dedicated cluster.
404 InvalidParam The specified parameter is invalid. The error message returned because invalid parameters are specified.
403 OperationDenied.PrimaryDBInstanceStatus The operation is not permitted due to status of primary instance. The error message returned because the status of the primary instance does not support this operation. The primary instance supports this operation only when it is in the Running state.
404 InvalidDBInstance.NotFound The specified instance does not exist or is not supported. The error message returned because the instance does not exist or is not supported.
400 InvalidDBInstanceName.NotFound The specified DB instance name does not exist. The error message returned because the instance ID specified by the DBInstanceId parameter cannot be found. Enter a valid value for the DBInstanceId parameter and try again.
404 AllocateResourceFailed Failed to allocate resources. Please check the zone and the host you selected. The error message returned because the system fails to apply for resources. Check whether the dedicated cluster provides sufficient resources that can be allocated to the selected host and zone.
400 InvalidPrimaryCustinsStatus Primary DBInstance status is not Active. The error message returned because the status of the primary instance that is attached with the read-only instance does not support this operation. The primary instance supports this operation only when it is in the Running state.

For a list of error codes, visit the API Error Center.