CreateMySQLMasterSlaveDataSource

2025-10-30 08:37:50  Updated

This topic describes the CreateMySQLMasterSlaveDataSource API provided by OceanBase Migration Service (OMS) Community Edition.

Purpose

You can call this API to create a primary or standby MySQL data source.

Call description

Limitations

This API is applicable to OMS Community Edition V4.2.4 and later.

Request path

POST /api/v2?Action=CreateMySQLMasterSlaveDataSource

Request parameters

Parameter Type Description
master Object The data source information of the primary MySQL database.
├─ name String The ID of the data source. We recommend that you set it to a combination of digits and letters. It must not contain any spaces and cannot exceed 32 characters in length.
Note that the value of the name parameter of the primary database must be the same as that of the standby database.
├─ ip String The IP address of the host where the database is located.
├─ port Integer The port number of the host where the database is located.
├─ schema String The name of the database. Data migration or synchronization is performed only on the specified database.
├─ username String The username of the database user intended for data migration or synchronization.
├─ password String The password of the database user, which must be Base64-encoded.
├─ tryKeepHb Boolean Specifies whether to allow OMS Community Edition to automatically write heartbeat data to this database during incremental synchronization. This resolves the problem of high latency when no business data is written in the source database.
├─ region String The region of the data source.
├─ description String The description of the data source, which cannot exceed 128 characters in length.
├─ role String Specifies whether the database is the primary database or the standby database. For the primary database, the value of this parameter is fixed to MASTER.
slave Object The data source information of the standby MySQL database.
├─ name String The ID of the data source. We recommend that you set it to a combination of digits and letters. It must not contain any spaces and cannot exceed 32 characters in length.
Note that the value of the name parameter of the primary database must be the same as that of the standby database.
├─ ip String The IP address of the host where the database is located.
├─ port Integer The port number of the host where the database is located.
├─ schema String The name of the database. Data migration or synchronization is performed only on the specified database.
├─ username String The username of the database user intended for data migration or synchronization.
├─ password String The password of the database user, which must be Base64-encoded.
├─ tryKeepHb Boolean Specifies whether to allow OMS Community Edition to automatically write heartbeat data to this database during incremental synchronization. This resolves the problem of high latency when no business data is written in the source database.
├─ region String The region of the data source.
├─ description String The description of the data source, which cannot exceed 128 characters in length.
├─ role String Specifies whether the database is the primary database or the standby database. For the standby database, the value of this parameter is fixed to SLAVE.

Response parameters

Parameter Type Description
success Boolean Indicates whether the call is successful.
errorDetail Object The error details.
code String The error code.
message String The error description.
advice String The suggestions about how to resolve the error.
requestId String The ID of the request.
pageNumber Integer The number of the page returned.
pageSize Integer The number of entries returned on each page.
totalCount Integer The total number of entries returned.
cost String The time spent in processing the request, in seconds.
data List The IDs of the primary and standby MySQL data sources.

Examples

Sample request

{
    "master": {
        "name": "mysql_test",
        "ip": "xxx.xxx.xxx.1",
        "port": 2883,
        "schema": "test",
        "userName": "tes***",
        "password": "pas***",
        "tryKeepHb": true,
        "region": "cn-anhui",
        "description": null,
        "role": "MASTER"
    },
    "slave": {
        "name": "mysql_test",
        "ip": "xxx.xxx.xxx.1",
        "port": 2883,
        "schema": "test",
        "userName": "tes***",
        "password": "pas***",
        "tryKeepHb": true,
        "region": "cn-anhui",
        "description": null,
        "role": "SLAVE"
    }
}

Sample response

{
    "success": true,
    "errorDetail": null,
    "code": null,
    "message": null,
    "advice": null,
    "requestId": "a7b57****",
    "pageNumber": null,
    "pageSize": null,
    "totalCount": null,
    "cost": "27 ms",
    "data": [
        "e_abc****",
        "e_def****"
    ]
}

Contact Us