Help Center/ Distributed Cache Service/ API Reference/ API V2/ Data Migration/ Configuring an Online Data Migration Task
Updated on 2022-09-19 GMT+08:00

Configuring an Online Data Migration Task

Function

This API is used to configure an online data migration task.

URI

POST /v2/{project_id}/migration/{task_id}/task

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

task_id

Yes

String

Online migration task ID.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

migration_method

Yes

String

Type of the migration, which can be full migration or incremental migration.

  • Full migration: Suitable for scenarios where services can be interrupted. Data is migrated at one time. Source instance data updated during full migration will not be migrated to the target instance.
  • Incremental migration: Suitable for scenarios requiring minimal service downtime. The incremental migration parses logs to ensure data consistency between the source and target instances. Value options are as follows:
  • full_amount_migration: full migration
  • incremental_migration: incremental migration

Enumeration values:

  • full_amount_migration
  • incremental_migration

resume_mode

Yes

String

Reconnection mode. In automatic reconnection mode, if the source and target instances are disconnected due to network exceptions, automatic reconnections will be performed indefinitely. Full synchronization will be triggered and requires more bandwidth if incremental synchronization becomes unavailable. Exercise caution when enabling this option. Values:

  • auto: automatically reconnect.
  • manual: manually reconnect.

Enumeration values:

  • auto
  • manual

bandwidth_limit_mb

No

String

"Bandwidth limit. For incremental migration, you can limit the bandwidth to ensure smooth service running. When the data synchronization speed reaches the limit, it can no longer increase.

  • Unit: MB/s
  • Value range: an integer from 1 to 10,241

source_instance

Yes

ConfigMigrationInstanceBody object

Source Redis information.

target_instance

Yes

ConfigMigrationInstanceBody object

Target Redis information.

Table 3 ConfigMigrationInstanceBody

Parameter

Mandatory

Type

Description

id

No

String

Redis instance ID. (If addrs is not set, id must be set.)

addrs

No

String

Redis instance address. (If id is not set, addrs must be set.)

password

No

String

Redis password. If a password is set, this parameter is mandatory.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

id

String

Migration task ID.

name

String

Migration task name.

status

String

Migration task status. The value can be SUCCESS, FAILED, MIGRATING, or TERMINATED.

Enumeration values:

  • SUCCESS
  • FAILED
  • MIGRATING
  • TERMINATED

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

error_msg

String

Error message.

Maximum: 1024

error_code

String

Error code.

Maximum: 9

error_ext_msg

String

Extended error information. This parameter is not used currently and is set to null.

Maximum: 1024

Status code: 401

Table 6 Response body parameters

Parameter

Type

Description

error_msg

String

Error message.

Maximum: 1024

error_code

String

Error code.

Maximum: 9

error_ext_msg

String

Extended error information. This parameter is not used currently and is set to null.

Maximum: 1024

Status code: 403

Table 7 Response body parameters

Parameter

Type

Description

error_msg

String

Error message.

Maximum: 1024

error_code

String

Error code.

Maximum: 9

error_ext_msg

String

Extended error information. This parameter is not used currently and is set to null.

Maximum: 1024

Status code: 404

Table 8 Response body parameters

Parameter

Type

Description

error_msg

String

Error message.

Maximum: 1024

error_code

String

Error code.

Maximum: 9

error_ext_msg

String

Extended error information. This parameter is not used currently and is set to null.

Maximum: 1024

Status code: 500

Table 9 Response body parameters

Parameter

Type

Description

error_msg

String

Error message.

Maximum: 1024

error_code

String

Error code.

Maximum: 9

error_ext_msg

String

Extended error information. This parameter is not used currently and is set to null.

Maximum: 1024

Example Requests

POST https://{dcs_endpoint}/v2/{project_id}/migration/{task_id}/task

{
  "migration_method" : "incremental_migration",
  "bandwidth_limit_mb" : 123,
  "resume_mode" : "auto",
  "source_instance" : {
    "id" : null,
    "addrs" : "192.168.1.1:6379,192.168.0.0:6379",
    "password" : "xxxxxx"
  },
  "target_instance" : {
    "id" : "cf4a05df-1c38-47c5-bb5a-0a7b3673b3bd",
    "addrs" : null,
    "password" : null
  }
}

Example Responses

Status code: 200

Online data migration task configured.

{
  "id" : "90754308-a156-406f-a837-8f852f38a646",
  "name" : "dcs-migration-1db7",
  "status" : "FULLMIGRATING"
}

Status Codes

Status Code

Description

200

Online data migration task configured.

400

Invalid request.

401

Invalid authentication information.

403

The request is rejected.

404

The requested resource is not found.

500

Internal service error.

Error Codes

See Error Codes.