Trusting targets and exchanging Db2 TLS certificates
After you activate replication on the source and target systems, you must use the Db2 Q Replication REST API to trust the target and exchange Transport Layer Security (TLS) certificates between source and target systems.
About this task
- The basic authorization token of the replication source database.
- The hostname of the replication target database.
- The username of the replication target database.
- The user password of the replication target database.
- The Replication REST API server external port number for the replication target database.
- The Target environment (DB2U-SA-DB2OLTP)
echo "<source_db_username>:<source_db_password>" | base64
where source
refers to either the source or destination database.oc get svc -n <your_db2_instance_namespace> | grep <your_db2_instance_id> | grep 9444 | sed 's/.*9444://' | sed 's/\/TCP.*//')
Procedure
Results
The trust-target operation is complete when a response message that contains "state":
"TRUSTED"
is returned. The replication source database then starts communicating with the
target REST API server. Until this value is returned, examine the error code, message, and
resolution in the response.
The exchanging of Db2 TLS
certificates is complete when a response message that contains "executionState":
"COMPLETED", "overallJobResult": "PASS"
is returned. The replication source database and
the replication target database can now connect to one another to continue the replication setup.
Until these values are returned, examine the error code, message, and resolution in the
response.
HTTP Status Code | Reason | Response Model |
---|---|---|
200 |
Target is trusted and Db2 TLS certificate exchanged | The user request returns "state": "TRUSTED" when the trust-target operation
is complete:
: The user request returns a job (id ) and URL in exchanging Db2 SSL
certificates:: The user request returns a successful response for the completion of the API call
(sample value):
|
4xx | Client request error | The user request was not fulfilled due to malformed request syntax or other
client issues:
|
5xx | Server error | The user request appeared valid, but was not fulfilled due to an issue with the
server:
|
Example
curl –insecure -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: Basic ZHNhZG06MDNRVWlMczFhcmoxb3ky' -d '{ "targetDatabaseHost": "dr-target2.ibm.com", "targetDatabaseUsername": "dradmin1", "targetDatabasePassword": "dradminpassword", "targetRestServerPort": 32483 }' 'https://dr-source1.ibm.com:31023/dr/v2/target/trust-target?targetEnvironment=DB2U-SA-DB2WH'
{
"name": "TRUST_TARGET_SUCCESS",
"message": "Trust Targets process complete.",
"values": [
{
"key": "targetDatabaseHost",
"value": "dr-target2.ibm.com"
},
{
"key": "targetDatabaseUsername",
"value": "dsadm"
}
],
"state": "TRUSTED"
}
dr-source1.ibm.com
and the target container
dr-target2.ibm.com
:Curl --insecure -X PUT --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: Basic ZHNhZG06MDNRVWlMczFhcmoxb3ky' -d '{ "dbUsername": "dradmin1", "dbPassword": "dradminpassword" }'
'https://dr-source1.ibm.com:31023/dr/v1/target/configure_db2_ssl/dr-source1.ibm.com/dr-target2.ibm.com/30138/BLUDB/32483?restartOption=Y'
{
"id": 6,
"url": "https://dr-source1.ibm.com:31023/dr/v1/target/progress/6"
}