Refreshing the target database secret
If you change the secret for accessing the target database service, you have to ensure that Data Gate can pick up the new secret, so that both services use the same secret.
Procedure
- Change the secret for accessing the target database service by following steps 1 through 3 in Updating the password secrets. Make sure to leave out step 4, that is, do not restart the database engine pod.
- Identify the Data Gate instance identifier, and assign the value to
the variable
DG_INSTANCE_IDby issuing theoc get dginstancecommand. For example:oc get dginstance -n ${PROJECT_CPD_INST_OPERANDS} NAME VERSION BUILD STATUS RECONCILED AGE dg1699914520773847 5.0.0 5.0.0.82 Completed 5.0.0 6h58mIn this example, the instance ID is
dg1699914520773847. Set the variableDG_INSTANCE_IDto this instance ID. - Identify the Data Gate instance pod, and assign the value to the
variable
DG_PODby issuing the followingoc get podcommand:DG_POD=$(oc get pod -n ${PROJECT_CPD_INST_OPERANDS} -l icpdsupport/app=dg-instance-server,\ icpdsupport/serviceInstanceId=`echo ${DG_INSTANCE_ID} | sed 's/^dg//'` -o jsonpath='{.items[0].metadata.name}') - Stop the Data Gate synchronization
function.
- To this end, run the following command to access the proper container:
oc exec -it -n ${PROJECT_CPD_INST_OPERANDS} ${DG_POD} -c data-gate-apply bash - To stop the synchronization function, run the following command:
/head/tools/datagate-apply/stop_apply.shIf the command runs successfully, the screen output looks like this:Datagate-Apply-Stop: Stopping the datagate-apply instance:[XY1A]. It usually takes up to 1 minute. Datagate-Apply-Stop: Suspend the datagate-apply instance:[XY1A]. SUCCESS - Instance XY1A is now SUSPENDED. Datagate-Apply-Stop: Suspend the datagate-apply instance:[XY1A] successfully. SUCCESS - Instance XY1A is now stopped. Datagate-Apply-Stop: Stop the datagate-apply instance:[XY1A] successfully.
- To this end, run the following command to access the proper container:
- Shut down the db2u pod.
- Get the db2u sts name:
oc get sts -n ${PROJECT_CPD_INST_OPERANDS} | grep db2uThe sts name is output on the screen. See the following example:c-db2oltp-1629250582941130-db2u 1/1 4d18h
- Shut down the db2u pod. Example:
oc scale sts -n ${PROJECT_CPD_INST_OPERANDS} c-db2oltp-1629250582941130-db2u --replicas=0 - Rerun the command in step 5.a to check the state of the
db2u pod. The screen output must indicate that no db2u pod is running. This is indicated by the numbering 0/1. For example:
c-db2oltp-1629250582941130-db2u 0/1 4d18h
- Get the db2u sts name:
- Refresh the db2inst1 password in the Data Gate configuration file and restart the Data Gate server service.
- Access the data-gate-server container by running the following
command:
oc exec -it -n ${PROJECT_CPD_INST_OPERANDS} ${DG_POD} -c data-gate-server bash - Run the following command to make the Data Gate server pick up the changed target database
secret:
/head/tools/datagate-server/refresh_db2luw_password.shA successful command execution generates the following screen output:2023-06-13 13:41:32 - Refresh-Password: Start to refresh password 2023-06-13 13:41:32 - Refresh-Password: Enforce /head/dwa/etc/dwa.server.password-salt permission to 400 Accelerator-Stop: Found the process of Datgate Server and start to shutdown it. Accelerator-Stop: Datgate Server has been stopped successfully 2023-06-13 13:41:33,250 - INFO - The generation of the dwa password for the platform user was successful 2023-06-13 13:41:33. . . . Accelerator-Start: Please checkout the detailed server log from /head/dwa/var/log/ffdc/dwa-server.stdout.2023-06-13-13-41-34-UTC 2023-06-13 13:41:34 - Refresh-Password: Refresh password successfully
- Access the data-gate-server container by running the following
command:
- Restart the db2u pod.
- Run the following command:
oc scale sts -n ${PROJECT_CPD_INST_OPERANDS} c-db2oltp-1629250582941130-db2u --replicas=1 - Display the STS name of the db2u pod once more
to verify the restart:
oc get sts -n ${PROJECT_CPD_INST_OPERANDS} | grep db2uAfter a successful restart, the screen output displays 1/1 running db2u pods. Example:c-db2oltp-1629250582941130-db2u 1/1 4d18h
- Run the following command:
- Restart the Data Gate synchronization
function.
- Access the data-gate-apply container by running the following
command:
oc exec -it -n ${PROJECT_CPD_INST_OPERANDS} ${DG_POD} -c data-gate-apply bash - To start the synchronization function, run the following command:
/head/tools/datagate-apply/start_apply.shIf the command runs successfully, the screen output looks like this:Datagate-Apply-Start: Wait for monitor to start the datagate-apply instance:[XY1A]. Datagate-Apply-Start: Remove the suspend file for the datagate-apply instance:[XY1A]. Datagate-Apply-Start: 1 - checking if the datagate-apply instance: [XY1A] is running. Datagate-Apply-Start: The datagate-apply process has been started successfully. Datagate-Apply-Start: Start the datagate-apply instance:[XY1A] successfully.
- Access the data-gate-apply container by running the following
command: