如何搭建active standby subscirber(TimesTen)

datastore 27 a, 26 a, 08 c subscriber bill_test1,35 d subscriber bill_bk2
=================setup==================
1. create the datastore on 27
[a]
Driver=/home/abm/TimesTen/abm/lib/libtten.a
DataStore=/abm2data/datastore/a
LogDir=/abm2data/log/a
ConnectionCharacterSet=ZHS16GBK
DatabaseCharacterSet=ZHS16GBK
PermSize=128
TempSize=20
LogBuffSize=131072
LogFileSize=128
PrivateCommands=1
CkptLogVolume=0
CkptFrequency=300
RecoveryThreads=16
OracleID=oragc
PassThrough=0
WaitForConnect=0
Connections=100
Authenticate=1
DurableCommits=0
UID=abm2
PWD=abm2
ORACLEPWD=abm2

2. create user on 27
$ ttisql TT_ABM

Copyright (c) 1996-2008, Oracle. All rights reserved.
Type ? or "help" for help, type "exit" to quit ttIsql.
All commands must end with a semicolon character.

 

connect "DSN=TT_ABM";
Connection successful: DSN=TT_abm;UID=abm;DataStore=/home/abm/TimesTen/abm/info/TT_abm;DatabaseCharacterSet=US7ASCII;ConnectionCharacterSet=US7ASCII;DRIVER=/home/abm/TimesTen/abm/lib/libtten.a;TypeMode=0;
(Default setting AutoCommit=1)
Command> create user abm2 identified by 'abm2';
Command> grant all to abm2;


3. create datastore on 26
[a]
Driver=/home/abm/TimesTen/abm/lib/libtten.a
DataStore=/home/abm/TimesTen/abm/test/a
LogDir=/home/abm/TimesTen/abm/test
ConnectionCharacterSet=ZHS16GBK
DatabaseCharacterSet=ZHS16GBK
PermSize=128
TempSize=20
LogBuffSize=131072
LogFileSize=128
PrivateCommands=1
CkptLogVolume=0
CkptFrequency=300
RecoveryThreads=16
OracleID=oragc
PassThrough=0
WaitForConnect=0
Connections=100
Authenticate=0
DurableCommits=0
UID=abm2
PWD=abm2
ORACLEPWD=abm2

4. create user on 26
$ ttisql TT_ABM

Copyright (c) 1996-2008, Oracle. All rights reserved.
Type ? or "help" for help, type "exit" to quit ttIsql.
All commands must end with a semicolon character.

 

connect "DSN=TT_ABM";
Connection successful: DSN=TT_abm;UID=abm;DataStore=/home/abm/TimesTen/abm/info/TT_abm;DatabaseCharacterSet=US7ASCII;ConnectionCharacterSet=US7ASCII;DRIVER=/home/abm/TimesTen/abm/lib/libtten.a;TypeMode=0;
(Default setting AutoCommit=1)
Command> create user abm2 identified by 'abm2';
Command> grant all to abm2;

5. create datastore at 08
[c]
Driver=/home/tt/TimesTen/abm/lib/libtten.a
DataStore=/home/tt/TimesTen/abm/test/c
LogDir=/home/tt/TimesTen/abm/test
ConnectionCharacterSet=ZHS16GBK
DatabaseCharacterSet=ZHS16GBK
PermSize=128
TempSize=20
LogBuffSize=131072
LogFileSize=128
PrivateCommands=1
CkptLogVolume=0
CkptFrequency=300
RecoveryThreads=16
OracleID=oragc
PassThrough=0
WaitForConnect=0
Connections=100
Authenticate=0
DurableCommits=0
UID=abm2
PWD=abm2
ORACLEPWD=abm2

6. create user at 08 on tt
create user abm2 identified by 'abm2';
grant all to abm2;

7. create datastore at 35
[d]
Driver=/tt/TimesTen/abm/lib/libtten.a
DataStore=/tt/TimesTen/abm/test/d
LogDir=/tt/TimesTen/abm/test
ConnectionCharacterSet=ZHS16GBK
DatabaseCharacterSet=ZHS16GBK
PermSize=128
TempSize=20
LogBuffSize=131072
LogFileSize=128
PrivateCommands=1
CkptLogVolume=0
CkptFrequency=300
RecoveryThreads=16
OracleID=oragc
PassThrough=0
WaitForConnect=0
Connections=100
Authenticate=0
DurableCommits=0
UID=abm2
PWD=abm2
ORACLEPWD=abm2

8. create user at 35 on tt
create user abm2 identified by 'abm2';
grant all to abm2;


9. create cached table on oracle
create table readtab(a number not null primary key, b varchar2(31));
insert into readtab values(1,'hello');
insert into readtab values(2,'world');

10. create table on tt at 27 for replication
create table test(a int, primary key (a));
insert into test values(1);
commit;

11. create cache group at 27 on tt
call ttCacheUidPwdSet('abm2','abm2');
call ttCacheStart;
create readonly cache group readcache autorefresh interval 10 seconds from readtab(a number not null primary key, b varchar2(31));
load cache group readcache commit every 256 rows;
select * from readtab;

12. set cache group autorefresh state paused for create active-standby pair at 27 on tt
alter cache group readcache set autorefresh state paused;

13. create active-standby pair on tt at 27
CREATE ACTIVE STANDBY PAIR a ON "abm_app2", a ON "abm_app1"
RETURN TWOSAFE
SUBSCRIBER c on "bill_test1",d on "bill_bk2"
STORE a ON "abm_app2" TIMEOUT 30
STORE a ON "abm_app1" TIMEOUT 30
Exclude CACHE GROUP ABM2.READCACHE;
commit;

14. start replication agent & set 27 tt as the active role on tt
call ttrepstart;
call ttrepstateset('ACTIVE');

15. at 26, duplicate the datastore from 27
ttRepAdmin -duplicate -from a -host "abm_app2" -compression 1 -nokeepCG -UID "abm2" -PWD "abm2" -localhost "abm_app1" a


16. at 26, on tt
call ttrepstart;
call ttrepstateget;
< STANDBY >

17. at 08,duplicate from standby and start replication agent
ttRepAdmin -duplicate -from a -host "abm_app1" -nokeepCG -UID "abm2" -PWD "abm2" -localhost "bill_test1" c
ttadmin -repstart c

18. at 35, duplicate from standby and start replication agent
ttRepAdmin -duplicate -from a -host "abm_app1" -nokeepCG -UID "abm2" -PWD "abm2" -localhost "bill_bk2" d
ttadmin -repstart d

19. at 27, insert
insert into test values(3);
commit;

20. at 26, verify the result
select * from test;

21. at 08, verify the result
select * from test;

22. at 35, verify the result
select * from test;


23. at 27, on tt
alter cache group readcache set autorefresh state on;


24. create cache group at 26
drop table ABM2.READTAB;

call ttrepstop;
call ttCacheUidPwdSet('abm2','abm2');
call ttCacheStart;
create readonly cache group readcache autorefresh interval 1 seconds from readtab(a number not null primary key, b varchar2(31));
load cache group readcache commit every 256 rows;
select * from readtab;

25. at 26, start replication on tt
call ttrepstart;

26. on oracle, insert for test cache group;
SQL> insert into readtab values(19,'t');

1 row created.

SQL> commit;

Commit complete.

27. verify cache table on 26, 27
select * from readtab;


***************************************************************

=================recover ative failure, 27 active, 26 standby==================
1. at 27, kill daemona
kill -9 3811 deamon pid

2. at 26, on tt
Command> call ttRepStateSet('ACTIVE');
Command> call ttrepstateget;
< ACTIVE >

3. at 26, on tt
Command>call ttRepStateSave('FAILED','a', 'abm_app2');

4. on oracle insert row to test cache group
SQL> insert into readtab values(11,'a');
1 row created.
SQL> commit;
Commit complete.

5. on tt at 26, verify
Command> select * from readtab;

6. on tt at 26, insert to verify replication
Command> insert into test values(20);
1 row inserted.
Command> insert into test values(21);
1 row inserted.
Command> commit;

7. on tt at 27, start daemon
ttdaemonadmin -start -force
ttdestroy a

8. at 27,
ttRepAdmin -duplicate -from a -host "abm_app1" -compression 1 -nokeepCG -UID "abm2" -PWD "abm2" -localhost "abm_app2" a

9. drop readtab, and create cachegroup at 27 on tt,
drop table readtab;
call ttCacheUidPwdSet('abm2','abm2');
call ttCacheStart;
create readonly cache group readcache autorefresh interval 1 seconds from readtab(a number not null primary key, b varchar2(31));
load cache group readcache commit every 256 rows;
select * from readtab;

10. at 27
Command> call ttrepstart;
Command> call ttRepStateGet;
< STANDBY >

11. on tt at 26,
Command> insert into test values(22);
1 row inserted.
Command> insert into test values(23);
1 row inserted.
Command> commit;

12. on tt, at 27, verify replication
Command> select * from test;


=================standby failure & recovery 27 active, 26 stand by==================
1. at 26, kill daemona
kill -9 3811 deamon pid


2. at 27,
call ttRepStateSave('FAILED','a', 'abm_app1');

2. on tt at 26, start daemon
ttdaemonadmin -start -force
ttdestroy a
ttRepAdmin -duplicate -from a -host "abm_app2" -compression 1 -nokeepCG -UID "abm2" -PWD "abm2" -localhost "abm_app1" a

3. drop readtab, and create cachegroup at 26 on tt,
drop table readtab;
call ttCacheUidPwdSet('abm2','abm2');
call ttCacheStart;
create readonly cache group readcache autorefresh interval 1 seconds from readtab(a number not null primary key, b varchar2(31));
load cache group readcache commit every 256 rows;
select * from readtab;

4. at 26
Command> call ttrepstart;
Command> call ttRepStateGet;
< STANDBY >


=============================subscriber failure 08 c==============
1. at 08
ttdaemonadmin -start -force
ttdestroy c

2. at 08,duplicate from standby and start replication agent
ttRepAdmin -duplicate -from a -host "abm_app1" -nokeepCG -UID "abm2" -PWD "abm2" -localhost "bill_test1" c
ttadmin -repstart c

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值