重建完複製器後,需要重建備機,因爲在重建複製器的過程中表與複製器解除關係,重建的這段時間內日誌可能會丟失,如果不重建備機的話,主備機的數據可能會不一致。
The steps are as follows(two nodes for example:node1&node2. node2 need recreate):
- On node1,stop the replication process.
$ttadmin -reppolicy manual ocs
$ttadmin -repstop ocs - On node1,drop the replication,call ttckpt to flush the data from the memory to disk.
$ttisql DSN
command>drop replication REP;
command> call ttckpt; - Destroy the tt on node2.
$ttadmin -reppolicy manual DSN
$ttadmin -rampolicy inuse DSN
$ttadmin -repstop DSN
$ttdaemonadmin -stop -force
$ttdaemonadmin -start
$ttdestroy DSN - On node1, create the replication definition(create replication …)
- On node1,start the replication process
$ttadmin -repstart ocs
$ttadmin -reppolicy always ocs
- On node1,duplicate the datastore from node1 to node2,(nohup mode avoid the window disconnected in an accident):
$ttrepadmin -duplicate -from ocs -host OCS1 -setmasterrepstart -uid ocs -pwd ocs -localhost OCS2 ocs
- On node2,start the replication
$ttadmin -repstart DSN
$ttadmin -reppolicy always DSN
- Recreate all the sequence of node2,use the backup definition of node2 before ttdestroy to avoid the sequence repetition value between two nodes.(the examples as belows):
Drop sequence TEST_ID_SEQ;
create sequence TEST_ID_SEQ
increment by 4
minvalue 1
maxvalue 9223372036854775807
start with 11033758037
cache 20;
- Check the replication status:(compare same table data amount between node1 and node2,check ttlog )
$ttstatus
$ttRepAdmin -dsn ocs -receiver -list
Command>>call ttlogholds;
Command>>select count(*) from table;