`
tower
  • 浏览: 239509 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

构建一个有实用价值的TimesTen高可用系统

阅读更多

本文原创作品,如需转载请注明来源,作者:姜涛, towerjt@gmail.com

 

构建一个有实用价值的 TimesTen 高可用系统

 

下图是我们要实现的系统架构:

 

从上图可以看到,系统中有一个 Oracle DB 位于 TEST_ORCL 机器上,两个 TimesTen 的实例,分别位于 TEST_TT1 TEST_TT2 两台机器上。其中,表 T1 的更新操作在 oracle db 中,然后同步到 TimesTen 中,由 oracle db 来保证数据的安全性;而表 T2 的更新操作在 TimesTen 中,然后同步到 oracle db 里面,由两个 TimesTen 之间的复制来保证数据的安全性。

T1 和表 T2 的这种存储方式在实际生产环境中,是一种很典型的情况。

 

下面将分步骤详细描述如何安装配置这个系统:

一、          test_orcl 上安装 oracle ,建立实例 bossdb ,用户 tzos/tzos ;在 test_tt1 test_tt2 上安装 oracle 客户端和 TimesTen 内存数据库和 Cache Connect ,新建 TimesTen 的用户 tzos/tzos

 

二、          test_tt1 test_tt2 上面建立 TimesTen 实例,配置文件如下:

[imdb]

Driver=/home/tt/TimesTen/tt70/lib/libtten.so

DataStore=/home/tt/TimesTen/imdb

DatabaseCharacterSet=ZHS16GBK

Authenticate=0

PermSize=64

TempSize=16

UID=tzos

OracleId=bossdb

OraclePwd=tzos

 

三、          oracle bossdb 里面,建立两个表:

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

create table t2(id number(2) primary key);

 

四、          分别在 test_tt1 test_tt2 上为表 T1 建立一个名为 cache_1 的只读 Cache Group

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

Command>call ttCacheStart;

Command>CREATE READONLY CACHE GROUP cache_1

AUTOREFRESH State ON

MODE INCREMENTAL INTERVAL 5 SECONDS

FROM

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

 

 

五、          测试 cache_1 ,在 oracl bossdb 中往 t1 insert 记录,在两个内存数据库中查看 t1 中的数据,将跟随发生变化

 

六、          分别在 test_tt1 test_tt2 上为表 T2 建议一个名为 cache_2 write through Cache Group

Command> create asynchronous writethrough cache group cache_2 from tzos.t2(id number(2) primary key);

 

七、          test_tt1 test_tt2 上分别建立 replication schema

Command>CREATE REPLICATION reptest

ELEMENT e_1 TABLE t2 MASTER imdb on "test_tt1" SUBSCRIBER imdb  on "test_tt2"

ELEMENT e_2 TABLE t2 MASTER imdb on "test_tt2" SUBSCRIBER imdb  on "test_tt1" ;

Command> call ttrepstart;

在两个数据库上都运行,说明两个数据库互为 Master Subscriber

 

八、          测试如下:

1、  test_tt1 中往 t2 insert 数据, test_tt2 test_orcl 的表中都能复制过来数据;

2、  test_tt2 中往 t2 insert 数据, test_tt1 test_orcl 的表中都能复制过来数据;

3、  停掉 test_tt2 timesten ,往 test_tt1 中的 t2 添加数据, test_orcl 中能复制到数据;再把 test_tt2 timesten 起来,刚才的数据也能复制过来。反之亦然。

 

 

  • 大小: 25.7 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics