Timesten學習3(高可用性)

blueocean926發表於2009-02-19
Normal 0 7.8 磅 0 2

1 高可用性

配置高可用性的TT,同時實現cache以及和後臺oracle rac叢集這種模式應該是最有價值的,兩臺TT同時對外提供服務,TT直接透過複製實現資料同步, 同時每個TT都透過cache agent把變化的資料傳遞到後臺的ORACLE,這種架構應該是我們最關心的,也是最有用的。

現在配置環境

192.168.100.105 server1

192.168.100.106 server2

192.168.10.105 server1-priv

192.168.10.106 server2-priv

192.168.100.215 server1-vip

192.168.100.216 server2-vip

server1,server2安裝timesten軟體,軟體目錄安裝在/timesten/Timesten,data store放在DataStore=/timesten/Timesten/peyton/rac,檔案以rac開頭,DSN=rac_tt70

資料庫為一RAC,分別裝在server1server2SID分別為orcl1orcl2

1.1 oracle上面建立需要同步的表

create user tt identified by tt default tablespace users;

SQL> create user tt identified by tt default tablespace users;

SQL> grant connect,resource to tt;

SQL> grant select any dictionary to tt;

SQL> connect tt/tt@orcl1

SQL> create table t1(id number(2) primary key);

1.2 配置tnsnames.ora

1.2.1 節點一server1

ORCL1 =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.215)(PORT = 1521))

)

(CONNECT_DATA =

(SID = ORCL1)

)

)

ORCL2 =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.216)(PORT = 1521))

)

(CONNECT_DATA =

(SID = ORCL2)

)

)

ORCL =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = server1-vip)(PORT = 1521))

(ADDRESS = (PROTOCOL = TCP)(HOST = server2-vip)(PORT = 1521))

)

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = ORCL)

(FAILOVER_MODE =

(TYPE = SELECT)

(METHOD = BASIC)

(RETRIES = 180)

(DELAY = 5)

)

)

)

LISTENER_SERVER1 =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = server1-vip)(PORT = 1521)(IP = FIRST))

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.105)(PORT = 1521)(IP = FIRST))

)

)

LISTENERS_ORCL =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = server1-vip)(PORT = 1521))

(ADDRESS = (PROTOCOL = TCP)(HOST = server2-vip)(PORT = 1521))

)

1.2.2 節點二server2

ORCL1 =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.215)(PORT = 1521))

)

(CONNECT_DATA =

(SID = ORCL1)

)

)

ORCL2 =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.216)(PORT = 1521))

)

(CONNECT_DATA =

(SID = ORCL2)

)

)

ORCL=

(DESCRIPTION=

(LOAD_BALANCE=OFF)

(FAILOVER=ON)

(ADDRESS_LIST=

(ADDRESS=(PROTOCOL=TCP)(HOST=server2-vip)(PORT=1521))

(ADDRESS=(PROTOCOL=TCP)(HOST=server1-vip)(PORT=1521))

)

(CONNECT_DATA=

(SERVICE_NAME=ORCL)

(SERVER=DEDICATED)

(FAILOVER_MODE=

(TYPE=SELECT)

(METHOD=BASIC)

(RETRIES=180)

(DELAY=5)

)

)

)

LISTENER_SERVER2 =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = server2-vip)(PORT = 1521)(IP = FIRST))

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.106)(PORT = 1521)(IP = FIRST))

)

)

LISTENERS_ORCL =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = server1-vip)(PORT = 1521))

(ADDRESS = (PROTOCOL = TCP)(HOST = server2-vip)(PORT = 1521))

)

1.3 配置rac_tt70

[rac_tt70]

Driver=/timesten/TimesTen/tt70/lib/libtten.so

DataStore=/timesten/Timesten/peyton/rac

DatabaseCharacterSet=ZHS16GBK

ConnectionCharacterSet=ZHS16GBK

Authenticate=0

PermSize=64

TempSize=16

UID=tt

OracleId=orcl

OraclePwd=tt

1.4 配置cache group

在兩個節點上建立oraclecache

[tt@server1 bin]$ ttIsql rac_tt70

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=rac_tt70";

Connection successful: DSN=rac_tt70;UID=tt;DataStore=/timesten/Timesten/peyton/rac;DatabaseCharacterSet=ZHS16GBK;ConnectionCharacterSet=ZHS16GBK;DRIVER=/timesten/TimesTen/tt70/lib/libtten.so;OracleId=orcl1;Authenticate=0;PermSize=64;TempSize=16;TypeMode=0;

(Default setting AutoCommit=1)

Command> call ttCacheUidPwdSet('tt','tt');

Command> call ttCacheStart;

Command>

CREATE USERMANAGED CACHE GROUP update_anywhere_t1

AUTOREFRESH State off MODE INCREMENTAL INTERVAL 5 SECONDS FROM t1(id number(2) primary key,PROPAGATE);

You can enable and disable AUTOREFRESH by setting its STATE to either ON or OFF through a CREATE CACHE GROUP or an ALTER CACHE GROUP statement. (ON is the default.)

AUTOREFRESH is scheduled by TimesTen when the transaction that sets its STATE to ON is committed When the STATE is set to OFF, changes to the Oracle tables are not captured or recorded. You can also use the ALTER CACHE GROUP statement to set the STATE to PAUSED. When the cache group is PAUSED, changes to the Oracle tables are captured and recorded on Oracle, but are not applied to the tables in the TimesTen cache group

[tt@server2 bin]$ ttIsql rac_tt70

connect "DSN=rac_tt70";

Connection successful: DSN=rac_tt70;UID=tt;DataStore=/timesten/Timesten/peyton/rac;DatabaseCharacterSet=ZHS16GBK;ConnectionCharacterSet=ZHS16GBK;DRIVER=/timesten/TimesTen/tt70/lib/libtten.so;OracleId=orcl1;Authenticate=0;PermSize=64;TempSize=16;TypeMode=0;

(Default setting AutoCommit=1)

Command> call ttCacheUidPwdSet('tt','tt');

Command> call ttCacheStart;

Command>

CREATE USERMANAGED CACHE GROUP update_anywhere_t1

AUTOREFRESH State off MODE INCREMENTAL INTERVAL 5 SECONDS

FROM t1(id number(2) primary key,PROPAGATE);

1.5 建立複製

在兩個節點上分別執行

Command> CREATE REPLICATION reptest

ELEMENT e_1 TABLE t1 MASTER rac on "server1" SUBSCRIBER rac on "server2"

ELEMENT e_2 TABLE t1 MASTER rac on "server2" SUBSCRIBER rac on "server1"

1.6 啟動replication agent

[tt@server1 ~]$ ttAdmin -repStart rac_tt70

RAM Residence Policy : inUse

Replication Agent Policy : manual

Replication Manually Started : True

Cache Agent Policy : manual

Cache Agent Manually Started : True

[tt@server2 ~]$ ttAdmin -repStart rac_tt70

RAM Residence Policy : inUse

Replication Agent Policy : manual

Replication Manually Started : True

Cache Agent Policy : manual

Cache Agent Manually Started : True

[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/48010/viewspace-1017607/,如需轉載,請註明出處,否則將追究法律責任。

相關文章