Stopping replication for a list of tables

You can stop the replication for a list of tables. The tables are identified by the replication set name, consistency group name, and subscription name.

Before you begin

This task must be run on the cluster host for the replication source. Ensure that you gather the following information before you run the API call:
  • The basic authorization token of the source on the cluster host.1
  • The hostname of the replication source database.
  • The external port number of the replication source database.2
  • The replication set name (rsName).3
  • The consistency group name (cgName).
  • The subscription name (subName).4
You need this information to run the needed Replication REST API calls.
1 You need to create a basic authorization token to run a cURL request. To create your token, run this command:
echo “<source_db_username>:<source_db_password>” | base64
2 You can retrieve the external port number of the replication source database by running this command:
oc get svc | grep <db2_instance_id> | grep db2u-engn-svc | grep 50001 | sed 's/.*50001://' | sed 's/\/TCP.*//')
3 You can find the replication set name (rsName) and consistency group name (cgName) by running this command:
curl --insecure -X GET --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: Basic <your_authorization_token>' 
'https://<source_hostname>:<source_rest_port>/dr/v1/replicationset'
4 You can find the subscription name (subName) by running this following command:
curl --insecure -X GET --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: Basic <your_authorization_token>' 'https://<source_hostname>:<source_rest_port>/dr/v1/<replication_set_name>/<consistency_group_name>'

About this task

This API call triggers a task to stop replication for a list of tables. Once this API call completes, any changes from the source do not replicate to the target.

Procedure

  1. Run the Q Replication REST API by using the following command:
    curl --insecure -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: Basic <your_authorization_token>' -d '{ "tableSubList": [ "<subscription_name>" ]  }' 'https://<source_hostname>:<source_rest_port>/dr/v1/replicationset/<replication_set_name>/<consistency_group_name>/stop-tablesubs'

    This API call returns a job number (id).

    {
      "id": <job_number>,
      "url": "https://<source_hostname>:<source_rest_external_port>/dr/v1/target/progress/<job_number>"
    }
    
  2. Include the job number in the following command to check the progress of the stop replication API call:
    curl --insecure -X GET --header 'Accept: application/json' --header 'Authorization: Basic <your_authorization_token>' 
    'https://<source_hostname>:<source_rest_port>/dr/v1/replicationset/progress/<job_number>'

Results

The stop of replication for a list of tables is complete when a response message that contains "executionState": "COMPLETED", "overallJobResult": "PASS" is returned. Until these values are returned, examine the error code, message, and resolution in the response.

The following table lists the possible HTTP status codes and response messages for the stop replication for a list of tables API call. It also includes sample code to show the response syntax.

HTTP Status Code Reason Response Model
200 CAPSTOP commands were inserted to stop table subscription. The user request returns a job (id) and URL as the API call starts (sample value):
{
  "id": 16,
  "url": "https://dr-source1.ibm.com:31023/dr/v1/replicationset/progress/16"
}
4xx Client request error The user request was not fulfilled due to malformed request syntax or other client issues:
{
  "errorCode": "string",
  "errorMessage": "string",
  "errorResolution": "string"
}
5xx Server error The user request appeared valid, but was not fulfilled due to an issue with the server:
{
  "errorCode": "string",
  "errorMessage": "string",
  "errorResolution": "string"
}

Example

The following example shows the command syntax for stopping a replication for a list of tables for replication set RS_MPP_2. See step 1.
curl --insecure -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: Basic ZHNhZG06aFRjT3dTTjR1RFo0N1Ew'  -d '{ "tableSubList": [ "RSMPP20001_DSADM_T6C", "RSMPP20001_DSADM_T7C" ]  }' 'https://dr-source1.ibm.com:31023/dr/v1/replicationset/RS_MPP_2/RSMPP20001/stop-tablesubs'
The following example shows the command syntax for checking the status of the stop replication for a list of tables by using the generated job number, 16, to monitor the status. See step 2.
curl --insecure -X GET --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: Basic ZHNhZG06aFRjT3dTTjR1RFo0N1Ew' 'https://dr-source1.ibm.com:31023/dr/v1/replicationset/progress/16'

What to do next

Checking the overall health