Timesten學習3(高可用性)
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,分別裝在server1和server2,SID分別為orcl1和orcl2
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
在兩個節點上建立oracle的cache
[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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 5、pgpool-II高可用性(一)資料庫的高可用性資料庫
- 【記憶體資料庫】TimesTen記憶體資料庫
- Pfsense HA(高可用性群集)
- vue3 學習筆記 (四)——vue3 setup() 高階用法Vue筆記
- 資料庫高可用性簡史資料庫
- 學習3
- GitHub 的 MySQL 高可用性實踐分享GithubMySql
- HBase可用性分析與高可用實踐
- MySQL 高可用性—keepalived+mysql雙主MySql
- SQL Server中的高可用性概覽SQLServer
- Unity3D學習筆記4——建立Mesh高階介面Unity3D筆記
- 雲中SQL Server高可用性最佳實踐SQLServer
- 4.1.7.2.3 快速應用程式通知高可用性事件事件
- 在Linux中,如何進行高可用性配置?Linux
- Java學習(3)Java
- java學習3Java
- Python 學習3Python
- 強化學習-學習筆記3 | 策略學習強化學習筆記
- redis學習——高階功能Redis
- 【Python3學習筆記】之【Python高階——多執行緒】Python筆記執行緒
- 3/8學習程序
- 3/13學習程序
- 3/25學習程序
- 3/19學習程序
- Vue3學習Vue
- 機器學習-3機器學習
- Protocol Buffers 3 學習Protocol
- Haskell學習-高階函式Haskell函式
- MySql 學習之路-高階2MySql
- 高通 QUP模組學習
- .1.7.2 應用程式高可用性與服務和FAN
- shell學習總結-3
- tensorflow學習筆記3筆記
- Vue學習筆記3Vue筆記
- PHP學習3——陣列PHP陣列
- 3/7學習進度
- 3/5學習進度
- javaweb學習之路(3)CookieJavaWebCookie
- mysql學習筆記3MySql筆記