Document Type | Technical Information
Category | Installation
Applicable Product Version | Tibero 7FS04PS
Document Number | PINTI007
Overview
- Part 1: ProSync Installation Preparation and Agent Installation
- Part 2: Instance Installation
- Part 3: CM Failover Setup
- Part 4: CM Failover Testing
Test Environment
| Category | OS | IP | DBMS Version | Prosync Version |
|---|---|---|---|---|
| Source_TAC0 | Rocky Linux release 8.10 | 10.10.10.61 | Tibero 7.2.4 (build 305455) | 4.6.0 (build 308985) |
| Source_TAC1 | Rocky Linux release 8.10 | 10.10.10.62 | Tibero 7.2.4 (build 305455) | 4.6.0 (build 308985) |
| Target_TAC0 | Rocky Linux release 8.10 | 10.10.10.63 | Tibero 7.2.4 (build 305455) | 4.6.0 (build 308985) |
| Target_TAC1 | Rocky Linux release 8.10 | 10.10.10.64 | Tibero 7.2.4 (build 305455) | 4.6.0 (build 308985) |
Note
The Prosync CM Failover feature is supported from Prosync version 4.3 and above.
Method
Prosync Installation Preparation
Extract Prosync Binary
Extract the Prosync binary. Perform this on both source and target DBs.
# tar -xvzf prosync4-bin-linux64_3.10-310173-20260209093704.tar.gz prosync4/bin/prs_papply prosync4/bin/prs_oapply prosync4/bin/prs_pllob prosync4/bin/prs_vf prosync4/bin/tblr_test prosync4/bin/prs_ext prosync4/bin/prs_oext prosync4/bin/prs_cm.sh prosync4/bin/prs_cred ... (omitted) ... prosync4/license/oss_licenses/Jean-loup_Gailly_and_Mark_Adler.txt prosync4/license/oss_licenses/MIT.txt prosync4/license/oss_licenses/oss_licenses.txt prosync4/license/oss_licenses/ICU_license.html prosync4/license/oss_licenses/Paul_Hsieh_OLD_BSD_license.txt prosync4/license/oss_licenses/Apache_v2.txt prosync4/license/oss_licenses/BSD_license.txt prosync4/license/oss_licenses/OpenSSL.txt prosync4/client/lib/libprsalloc.so prosync4/client/lib/libprstbregacy.so prosync4/client/lib/libprsmio.so prosync4/client/lib/libprsiparam.so prosync4/client/lib/libprsmsg.so prosync4/client/lib/libprsmdl.so
Modify bash_profile
Set environment variables according to the Prosync installation path. Configure on both source and target DBs.
#### Prosync 4.4.6 #### export PRS_HOME=/share/prosync4 export INSTANCE_ID=PRS_FAILOVER export PATH=$PRS_HOME/bin:$PRS_HOME/client/bin:$PATH export LD_LIBRARY_PATH=$PRS_HOME/lib:$PRS_HOME/client/lib:$LD_LIBRARY_PATH #### ProSync alias alias phome='cd $PRS_HOME' alias plog='cd $PRS_HOME/var/$INSTNACE_ID/log' alias pcfg='cd $PRS_HOME/config'
Add Parameters to $TB_SID.tip
Activate the following parameters so that Prosync can read the DB's Redo and Archive log files, then restart the DB. Perform on both source and target DBs.
$ vi $TB_HOME/config/$TB_SID.tip _ENABLE_LOG_MINER=Y _DDL_TRIGGER_ENABLE=Y _SPAN_UNDO=N $ tbdown immediate $ tbboot
Create Tables for Synchronization
Create on both source and target DBs.
$ tbsql sys/tibero SQL> create user test identified by test; SQL> grant resource, connect to test; SQL> create table test.t1 (c1 number primary key, c2 varchar(20)); SQL> create table test.t2 (c1 number primary key, c2 varchar(20)); SQL> create table test.t3 (c1 number primary key, c2 varchar(20));
Agent Installation
Set Installation Parameters
Configure prs_install_agent.cfg as below for Agent installation. (Perform only on one node of the source DB.)
$ cp $PRS_HOME/install/templates/prs_install_agent.cfg.template $PRS_HOME/install/prs_install_agent.cfg $ vi $PRS_HOME/install/prs_install_agent.cfg AGENT_CNT=4 AGENT_ID_0=src_agent1 AGENT_HOST_0=10.10.10.61 AGENT_PORT_0=7600 AGENT_CM_GROUP_0=SRC_CM AGENT_CM_ID_0=0 AGENT_ID_1=src_agent2 AGENT_HOST_1=10.10.10.62 AGENT_PORT_1=7700 AGENT_CM_GROUP_1=SRC_CM AGENT_CM_ID_1=1 AGENT_ID_2=tar_agent1 AGENT_HOST_2=10.10.10.63 AGENT_PORT_2=7800 AGENT_CM_GROUP_2=TAR_CM AGENT_CM_ID_2=0 AGENT_ID_3=tar_agent2 AGENT_HOST_3=10.10.10.64 AGENT_PORT_3=7900 AGENT_CM_GROUP_3=TAR_CM AGENT_CM_ID_3=1
- AGENT_CNT: Specifies the number of agents to install (required)
- AGENT_ID_[n]: Unique ID for each agent. Cannot start with a number and must be unique (required)
- AGENT_HOST_[n]: Host where the agent will be installed. Using IP address is recommended over hostname (required)
- AGENT_PORT_[n]: Port used by the agent (required)
- AGENT_CM_GROUP_[n]: When using CM Failover, specify the CM group name the agent belongs to
- AGENT_CM_ID_[n]: When using CM Failover, specify the ID of the CM the agent connects to. Must be unique within the group, but can be duplicated across different groups
Run Agent Install Script
After configuring prs_install_agent.cfg, run the installation script as follows.
$ sh prs_install_agent.sh
********************************************************************************
* Agent Install Step (1/4)
* Check System Parameters
********************************************************************************
* Checking system type...
Linux
* Checking PRS_HOME...
PRS_HOME: /share/prosync4
********************************************************************************
* Agent Install Step (2/4)
* Check install agent config file [prs_install_agent.cfg]
* Check Instance file [prs_instance.map]
********************************************************************************
* Checking configuration file...
[/share/prosync4/install/prs_install_agent.cfg] exists.
* Checking Agent configuration...
parameter check for Agent[0] Started
AGENT_ID: src_agent1
AGENT_HOST: 10.10.10.61
AGENT_PORT: 7600
AGENT_CM_GROUP: SRC_CM
AGENT_CM_ID: 0
parameter check for Agent[0] Done
parameter check for Agent[1] Started
AGENT_ID: src_agent2
AGENT_HOST: 10.10.10.62
AGENT_PORT: 7700
AGENT_CM_GROUP: SRC_CM
AGENT_CM_ID: 1
parameter check for Agent[1] Done
parameter check for Agent[2] Started
AGENT_ID: tar_agent1
AGENT_HOST: 10.10.10.63
AGENT_PORT: 7800
AGENT_CM_GROUP: TAR_CM
AGENT_CM_ID: 0
parameter check for Agent[2] Done
parameter check for Agent[3] Started
AGENT_ID: tar_agent2
AGENT_HOST: 10.10.10.64
AGENT_PORT: 7900
AGENT_CM_GROUP: TAR_CM
AGENT_CM_ID: 1
parameter check for Agent[3] Done
* Checking prs_instance.map file...
/share/prosync4/config/prs_instance.map not found... Creating default prs_instance.map file...
********************************************************************************
* Agent Install Step (3/4)
* Writing agent config file [/share/prosync4/install/prs_install_agent.cfg]
* Writing Instance file [/share/prosync4/config/prs_instance.map]
* Total Agent Cnt [4]
********************************************************************************
* Writing all agents.. cnt: 4
* Writing Agent.. Index: 0
* Writing Agent.. AGENT_ID: src_agent1
* Writing Agent.. AGENT_HOST: 10.10.10.61
* Writing Agent.. AGENT_PORT: 7600
* Writing Agent.. AGENT_CM_GROUP: SRC_CM
* Writing Agent.. AGENT_CM_ID: 0
* Writing Agent configuration...
/share/prosync4/config/prs_agent_src_agent1.cfg not found. Writing files...
Done.
* Writing Agent information...
* Writing Agent.. Index: 1
* Writing Agent.. AGENT_ID: src_agent2
* Writing Agent.. AGENT_HOST: 10.10.10.62
* Writing Agent.. AGENT_PORT: 7700
* Writing Agent.. AGENT_CM_GROUP: SRC_CM
* Writing Agent.. AGENT_CM_ID: 1
* Writing Agent configuration...
/share/prosync4/config/prs_agent_src_agent2.cfg not found. Writing files...
Done.
* Writing Agent information...
* Writing Agent.. Index: 2
* Writing Agent.. AGENT_ID: tar_agent1
* Writing Agent.. AGENT_HOST: 10.10.10.63
* Writing Agent.. AGENT_PORT: 7800
* Writing Agent.. AGENT_CM_GROUP: TAR_CM
* Writing Agent.. AGENT_CM_ID: 0
* Writing Agent configuration...
/share/prosync4/config/prs_agent_tar_agent1.cfg not found. Writing files...
Done.
* Writing Agent information...
* Writing Agent.. Index: 3
* Writing Agent.. AGENT_ID: tar_agent2
* Writing Agent.. AGENT_HOST: 10.10.10.64
* Writing Agent.. AGENT_PORT: 7900
* Writing Agent.. AGENT_CM_GROUP: TAR_CM
* Writing Agent.. AGENT_CM_ID: 1
* Writing Agent configuration...
/share/prosync4/config/prs_agent_tar_agent2.cfg not found. Writing files...
Done.
* Writing Agent information...
* Creating var directory...
* Created.
********************************************************************************
* Agent Install Step (4/4)
* Creating files for CM
********************************************************************************
AGENT_CM_ID detected
generating prs_0.sh...
PRS_HOME=/share/prosync4
AGENT_ID=src_agent1
prs_0.sh has created in $PRS_HOME/bin/
AGENT_CM_ID detected
generating prs_1.sh...
PRS_HOME=/share/prosync4
AGENT_ID=src_agent2
prs_1.sh has created in $PRS_HOME/bin/
AGENT_CM_ID detected
generating prs_0.sh...
PRS_HOME=/share/prosync4
AGENT_ID=tar_agent1
prs_0.sh has created in $PRS_HOME/bin/
AGENT_CM_ID detected
generating prs_1.sh...
PRS_HOME=/share/prosync4
AGENT_ID=tar_agent2
prs_1.sh has created in $PRS_HOME/bin/
Agent installation Done.
Verify Agent Installation Results
After installation is complete, you can check the result files at the following path.
$ cd $PRS_HOME/config $ ls -al total 51 -rw-rw-r-- 1 tibero dba 4 Jan 20 06:16 variant drwxr-xr-x 2 tibero dba 4096 Mar 5 08:06 templates drwxr-xr-x 8 tibero dba 4096 Mar 6 00:24 .. -rw-r--r-- 1 tibero dba 728 Mar 6 03:36 prs_instance.map -rw-r--r-- 1 tibero dba 310 Mar 6 04:17 prs_adm.cfg -rw-r--r-- 1 tibero dba 1010 Mar 6 04:48 prs_agent_src_agent1.cfg -rw-r--r-- 1 tibero dba 1010 Mar 6 04:48 prs_agent_src_agent2.cfg -rw-r--r-- 1 tibero dba 1010 Mar 6 04:48 prs_agent_tar_agent2.cfg -rw-r--r-- 1 tibero dba 1016 Mar 6 05:01 prs_agent_tar_agent1.cfg $ cat $PRS_HOME/config/prs_instance.map AGENT=(ID=src_agent1)(HOST=10.10.10.61)(PORT=7600)(CM_GROUP=SRC_CM)(CM_ID=0) AGENT=(ID=src_agent2)(HOST=10.10.10.62)(PORT=7700)(CM_GROUP=SRC_CM)(CM_ID=1) AGENT=(ID=tar_agent1)(HOST=10.10.10.63)(PORT=7800)(CM_GROUP=TAR_CM)(CM_ID=0) AGENT=(ID=tar_agent2)(HOST=10.10.10.64)(PORT=7900)(CM_GROUP=TAR_CM)(CM_ID=1)
CM Failover Script Setup
This script is used for the CM Failover feature, and environment variables needed to start the agent (such as TB_HOME, PRS_HOME, AGENT_ID) must be set.
When AGENT_CM_ID[n] is set, scripts in the format prs_<AGENT_CM_ID>.sh are automatically created in the $PRS_HOME/bin directory during Agent installation.
$ vi $PRS_HOME/bin/prs_0.sh (also modify $PRS_HOME/bin/prs_1.sh)
#!/bin/sh
export TB_HOME=/share/tibero_engine ## Enter TB_HOME
export PRS_HOME=/share/prosync4 ## Enter PRS_HOME
AGENT_ID=src_agent1 ## Enter agent_id
TIMEOUT_CNT=7
source $PRS_HOME/bin/prs_cm.sh
export logdir=$PRS_HOME/var
echo "`date +%Y/%m/%d\ %H:%M:%S` cm agent Start (Agent Command $1)" >> $logdir/cmagent.log
case $1 in
START)
echo "start $TIMEOUT_CNT $AGENT_ID" >> $logdir/cmagent.log
start $TIMEOUT_CNT $AGENT_ID
rc=$?
;;
PROBE)
echo "probe $TIMEOUT_CNT $AGENT_ID" >> $logdir/cmagent.log
probe $TIMEOUT_CNT $AGENT_ID
rc=$?
;;
DOWN)
echo "stop $TIMEOUT_CNT $AGENT_ID" >> $logdir/cmagent.log
stop $TIMEOUT_CNT $AGENT_ID
rc=$?
;;
KILL)
echo "stop $TIMEOUT_CNT $AGENT_ID" >> $logdir/cmagent.log
stop $TIMEOUT_CNT $AGENT_ID
rc=$?
;;
NOTI)
rc=0
;;
COMMIT)
echo "send $TIMEOUT_CNT $AGENT_ID ${@:2}" >> $logdir/cmagent.log
send $TIMEOUT_CNT $AGENT_ID ${@:2}
rc=$?
;;
*)
;;
esac
echo "`date +%Y/%m/%d\ %H:%M:%S` cm agent End (Agent Command $1)" >> $logdir/cmagent.log
exit $rcCaution
If the script runs in CM without permission issues but you encounter an rc=127 error, you can resolve it by changing
/bin/shto/bin/bash.
Agent Settings
Configure each Agent as follows.
$ vi $PRS_HOME/config/prs_agent_<agent_id>.cfg LOG_LEVEL=3 LOG_DIR=/share/prosync4/var/agent/src_agent1/log LOG_BACKUP_DIR=/share/prosync4/var/agent/src_agent1/log/backup USE_CM = Y PRS_AGENT_PROC_MAX_FAIL_CNT = 10 #Dependency Param : USE_CM=Y PRS_AGENT_PROC_STARTUP_TIMEOUT = 10 #Dependency Param : USE_CM=Y PRS_AGENT_PROC_STATUS_REPLY_TIMEOUT = 10 #Dependency Param : USE_CM=Y PRS_AGENT_PROC_STATUS_INTERVAL = 3 #Dependency Param : USE_CM=Y PRS_AGENT_CM_PROBE_TIMEOUT = 0 #Dependency Param : USE_CM=Y
- USE_CM: Set whether to use CM. If set to Y, monitors the status of subprocesses and restarts them upon failure (default: N)
- PRS_AGENT_PROC_MAX_FAIL_CNT: Maximum retry count to correct status when a subprocess failure occurs (default: 10)
- PRS_AGENT_PROC_STARTUP_TIMEOUT: Maximum wait time (seconds) after process startup until it is processed normally. If not processed normally, waits for the set time before retrying
- PRS_AGENT_PROC_STATUS_REPLY_TIMEOUT: Maximum wait time (seconds) if no response from subprocess. If exceeded, assumes the process is hung and restarts it
- PRS_AGENT_PROC_STATUS_INTERVAL: Interval at which the Agent process sends cmrctl check commands to CM
- PRS_AGENT_CM_PROBE_TIMEOUT: Maximum wait time (seconds) when checking CM status. If set to 0, waits indefinitely for cmrctl response (default: 0)