使用來源和目標上堡壘主機和資料庫主機的適當 IP 位址編輯命令檔。如果您能夠從本機機器存取來源與目標資料庫,請以本機方式重複使用 ZDM 服務工具公用金鑰,然後將它新增至來源與目標主機。
# exit out of the zdmuser shell
exit
# copy the public key to the opc user for download
sudo cp /home/zdmuser/.ssh/id_rsa.pub /home/opc
# exit the opc user shell, back to local host
exit
# copy the public key to the source and target hosts into authorized_keys file
ZDM_SERVICE_IP=ZDM_Service_IP_Address
SOURCE_DB_IP=
SOURCE_DB_BASTION=
TARGET_DB_IP=Target_DB_IP_Address
TARGET_DB_BASTION=
ZDM_USER=opc
SOURCE_USER=opc
TARGET_USER=opc
ssh ${ZDM_USER}@${ZDM_SERVICE_IP} 'cat /home/zdmuser/.ssh/id_rsa.pub' | ssh -J
${SOURCE_USER}@${SOURCE_DB_BASTION} ${SOURCE_USER}@${SOURCE_DB_IP} 'cat >>
~/.ssh/authorized_keys'
ssh ${ZDM_USER}@${ZDM_SERVICE_IP} 'cat /home/zdmuser/.ssh /id_rsa.pub' | ssh -J
${TARGET_USER}@${TARGET_DB_BASTION} ${TARGET_USER}@${TARGET_DB_IP} 'cat >>
~/.ssh/authorized_keys'