CLI-based O&M for the Connector component

2024-10-10 08:05:52  Updated

This topic describes the CLI-based O&M APIs for the Connector component (Full-Import and Incr-Sync) supported by OceanBase Migration Service (OMS).

Start a connector

/connector/task/v2/resume(POST)

Note

After a task is created, you cannot use this API to start a connector. If the task is in the suspended or other states, you can use this API to start a connector. On the System Parameters page, change the value of the operation_audit_log.retention_time parameter to set the retention period of operation audit records.

pullBackFlag (true) is valid only in a pullback scenario of the Incr-Sync component. restartFlag(true) is valid only in a restart scenario (restart based on the original Checker) of the Full-Import component. Others are recovery scenarios.

Input parameter Required? Type Description
taskName Yes String The name of the component.
pullBackFlag No Boolean Specifies whether to pull back the component. Default value: false.
restartFlag No Boolean Specifies whether to restart the component. Default value: false.

Sample request

curl -XPOST 'http://${cm_host:port}/connector/task/v2/resume?taskName=xxx.xxx.xxx.xxx-9000:connector_v2:p_493po****-incr_trans-1-0:0000000001'

Sample response

{
  "errCode": null,
  "errMsg": null,
  "errorDetail": null,
  "isSuccess": true,
  "result": "xxx.xxx.xxx.xxx-9000:connector_v2:p_493po****-incr_trans-1-0:0000000001",
  "retryable": null
}

Stop a connector

/connector/task/v2/stop(POST)

Input parameter Required? Type Description
taskName Yes String The name of the component.

Sample request

curl -XPOST 'http://${cm_host:port}/connector/task/v2/stop?taskName=xxx.xxx.xxx.xxx-9000:connector_v2:p_493po****-incr_trans-1-0:0000000001'

Sample response

{
  "errCode": null,
  "errMsg": null,
  "errorDetail": null,
  "isSuccess": true,
  "result": "xxx.xxx.xxx.xxx-9000:connector_v2:p_493****4-incr_trans-1-0:0000000001",
  "retryable": null
}

Update a connector

You can update only a connector in the stopped or abnormal state.

/connector/task/v2/update(POST)

Input parameter Required? Type Description
taskName Yes String The name of the component.
deleteParams No List Specifies to delete parameters. Example: scope1.key1,scope2.key2
updateConfigMap No Map<String, Map<String, String>> Specifies to update parameters. Example: scope:key:value

Sample request

curl -XPOST 'http://${cm_host:port}/connector/task/v2/update?taskName=xxx.xxx.xxx.xxx-9000:connector_v2:p_49****4-incr_trans-1-0:0000000001&deleteParams=source.checkpoint' \
--header 'Content-Type: application/json' \
--data-raw '{
    "source": {
        "username":"test"
    }
}'

Sample response

{
  "errCode": null,
  "errMsg": null,
  "errorDetail": null,
  "isSuccess": true,
  "result": "xxx.xxx.xxx.xxx-9000:connector_v2:p_493po***of4-incr_trans-1-0:0000000001",
  "retryable": null
}

Pull back a connector

A pullback operation is a combination of multiple operations such as stop, update checkpoint, and start. To pull the xxx.xxx.xxx.xxx-9000:connector_v2:p_493p****-incr_trans-1-0:0000000001 task back to 2023-02-13 19:00:00, you can run the following commands.

Note that subtopic in checkpoint is an existing value in the configuration.

date -j -f "%Y-%m-%d %H:%M:%S" "2023-02-13 19:00:00" +%s
1676286000
# stop
curl -XPOST 'http://${cm_host:port}/connector/task/v2/stop?taskName=xxx.xxx.xxx.xxx-9000:connector_v2:p_493p****-incr_trans-1-0:0000000001'
# update checkpoint
curl -XPOST 'http://${cm_host:port}/connector/task/v2/update?taskName=xxx.xxx.xxx.xxx-9000:connector_v2:p_493p****-incr_trans-1-0:0000000001&deleteParams=source.checkpoint' \
--header 'Content-Type: application/json' \
--data-raw '{
    "source": {
        "checkpoint":"{\"{subtopic}\":\"1676286000\"}"
    }
}'
# start
curl -XPOST 'http://${cm_host:port}/connector/task/v2/resume?taskName=xxx.xxx.xxx.xxx-9000:connector_v2:p_493p****-incr_trans-1-0:0000000001&pullBackFlag=true'

Migrate a connector

/connector/task/v2/migrate(POST)

Input parameter Required? Type Description
taskName Yes String The name of the component.
ip No String The IP address of the destination.

Sample request

curl -XPOST 'http://${cm_host:port}/connector/task/v2/migrate?taskName=xxx.xxx.xxx.xxx-9000:connector_v2:p_493p****-incr_trans-1-0:0000000001&ip=xxx.xxx.xxx.xxx'

Sample response

{
  "errCode": null,
  "errMsg": null,
  "errorDetail": null,
  "isSuccess": true,
  "result": "xxx.xxx.xxx.xxx-9000:connector_v2:p_493p****-incr_trans-1-0:0000000002",
  "retryable": null
}

Delete a connector

/connector/task/v2/delete(POST)

Input parameter Required? Type Description
taskName Yes String The name of the component.

Sample request

curl -XPOST 'http://${cm_host:port}/connector/task/v2/delete?taskName=xxx.xxx.xxx.xxx-9000:connector_v2:p_493p****-incr_trans-1-0:0000000001'

Sample response

{
  "errCode": null,
  "errMsg": null,
  "errorDetail": null,
  "isSuccess": true,
  "result": "xxx.xxx.xxx.xxx-9000:connector_v2:p_493p****-incr_trans-1-0:0000000001",
  "retryable": null
}

Contact Us