Step by Step TimesTen --- DataStore的雙向複製( 一)

feng_xin發表於2008-08-18

 

A機器上的fxtest_aa datastore B機器上的fxtest_bb datastore 雙向複製

 

Step 1: Create DataStore

 

A機器:

1, sys.odbc.ini檔案中加入fxtest_aa datastore 的配置

 

########################################

## Data store attributes fxtest_aa

########################################

[fxtest_aa]

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

DataStore=/ora/TimesTen/datastore/fxtest_aa

LogDir=/ora/TimesTen/datastore

DatabaseCharacterSet=AL32UTF8

Authenticate=0

# GroupRestrict=

Preallocate=1

Temporary=0

TypeMode=0

 

 

## First connection attributes

PermSize=380

TempSize=20

LogBuffSize=65536

LogFileSize=64

#LogFileSize=1

LogFlushMethod=1

LogAutoTruncate=0

Logging=1

LogPurge=1

CkptFrequency=600

CkptLogVolume=0

CkptRate=0

AutoCreate=1

Connections=100

ForceConnect=0

MemoryLock=4

Overwrite=0

RecoveryThreads=4

 

## General connection attributes

DurableCommits=0

ConnectionName=aa

Diagnostics=1

Isolation=1

LockLevel=0

LockWait=10

MatchLogOpts=0

PermWarnThreshold=75

PrivateCommands=0

SqlQueryTimeout=0

TempWarnThreshold=75

WaitForConnect=0

 

 

## NLS general connection attributes

ConnectionCharacterSet=AL32UTF8

NLS_NCHAR_CONV_EXCP=1

NLS_SORT=BINARY

 

2, 建立fxtest_aa datastore

 

$ ttisql fxtest_aa

 

Copyright (c) 1996-2007, Oracle.  All rights reserved.

Type ? or "help" for help, type "exit" to quit ttIsql.

All commands must end with a semicolon character.

 

connect "DSN=fxtest_aa";

Connection successful: DSN=fxtest_aa;UID=times;DataStore=/ora/TimesTen/datastore/fxtest_aa;DatabaseCharacterSet=AL32UTF8;ConnectionCharacterSet=US7ASCII;LogFileSize=64;WaitForConnect=0;Preallocate=1;DRIVER=/ora/TimesTen/tt70/TimesTen/tt70/lib/libtten.so;MemoryLock=4;LogBuffSize=65536;Authenticate=0;Isolation=1;LogDir=/ora/TimesTen/datastore;PermSize=380;TempSize=20;PermWarnThreshold=75;TempWarnThreshold=75;LockWait=10;SQLQueryTimeout=0;LogFlushMethod=1;Connections=100;LogAutoTruncate=0;CkptRate=0;CkptFrequency=600;CkptLogVolume=0;RecoveryThreads=4;TypeMode=0;

(Default setting AutoCommit=1)

Command>

 

3, 建立datastore 的物件

 

Command> create table reptable ( id number primary key, name varchar2(10));

 

 

B機器:

1,在sys.odbc.ini檔案中加入fxtest_bb datastore 的配置

 

##########################################

## Data store attributes  fxtest_bb

#########################################

[fxtest_bb]

Driver=/export/home/times/TimesTen/tt70/lib/libtten.so

DataStore=/export/home/times/TimesTen/datastore/fxtest_bb

LogDir=/export/home/times/TimesTen/datastore

DatabaseCharacterSet=AL32UTF8

Authenticate=0

# GroupRestrict=

Preallocate=1

Temporary=0

TypeMode=0

 

 

## First connection attributes

PermSize=380

TempSize=20

LogBuffSize=65536

LogFileSize=64

LogFlushMethod=1

LogAutoTruncate=0

Logging=1

LogPurge=1

CkptFrequency=600

CkptLogVolume=0

CkptRate=0

AutoCreate=1

Connections=100

ForceConnect=0

MemoryLock=4

Overwrite=0

RecoveryThreads=4

 

## General connection attributes

DurableCommits=0

ConnectionName=fxtest_bb

Diagnostics=1

Isolation=1

LockLevel=0

LockWait=10

MatchLogOpts=0

PermWarnThreshold=75

PrivateCommands=0

SqlQueryTimeout=0

TempWarnThreshold=75

WaitForConnect=0

 

 

## NLS general connection attributes

ConnectionCharacterSet=AL32UTF8

NLS_NCHAR_CONV_EXCP=1

NLS_SORT=BINARY

 

2, 建立fxtest_bb datastore

 

bjinms221.bj.com> ttisql fxtest_bb

 

Copyright (c) 1996-2007, Oracle.  All rights reserved.

Type ? or "help" for help, type "exit" to quit ttIsql.

All commands must end with a semicolon character.

 

 

connect "DSN=fxtest_bb";

Connection successful: DSN=fxtest_bb;UID=times;DataStore=/export/home/times/TimesTen/datastore/fxtest_bb;DatabaseCharacterSet=AL32UTF8;ConnectionCharacterSet=AL32UTF8;LogFileSize=64;WaitForConnect=0;Preallocate=1;DRIVER=/export/home/times/TimesTen/tt70/lib/libtten.so;MemoryLock=4;LogBuffSize=65536;Authenticate=0;Isolation=1;LogDir=/export/home/times/TimesTen/datastore;PermSize=380;TempSize=20;PermWarnThreshold=75;TempWarnThreshold=75;LockWait=10;SQLQueryTimeout=0;LogFlushMethod=1;Connections=100;LogAutoTruncate=0;CkptRate=0;CkptFrequency=600;CkptLogVolume=0;RecoveryThreads=4;NLS_NCHAR_CONV_EXCP=1;TypeMode=0;

(Default setting AutoCommit=1)

Command>

3, 建立datastore 的物件

 

Command> create table reptable ( id number primary key, name varchar2(10));

 

 

Step 2, 建立replication schema

 

1,在AB機器上分別執行如下建立replication schema的指令碼

指令碼:

CREATE REPLICATION fxtest.reptest

ELEMENT element_rep_aa datastore   

MASTER fxtest_aa ON "BJINMS216.BJ.COM" TRANSMIT NONDURABLE

SUBSCRIBER fxtest_bb ON "bjinms221.bj.com" RETURN RECEIPT    

ROUTE MASTER fxtest_aa ON "BJINMS216.BJ.COM" SUBSCRIBER fxtest_bb ON "bjinms221.bj.com" 

MASTERIP "10.194.22.16" priority 1 SUBSCRIBERIP "10.194.22.18" priority 1  

 

ELEMENT element_rep_bb datastore   

MASTER fxtest_bb ON "bjinms221.bj.com" TRANSMIT NONDURABLE     

SUBSCRIBER fxtest_aa ON "BJINMS216.BJ.COM" RETURN RECEIPT      

ROUTE MASTER fxtest_bb ON "bjinms221.bj.com" SUBSCRIBER fxtest_aa ON "BJINMS216.BJ.COM" 

MASTERIP "10.194.22.18" priority 1 SUBSCRIBERIP "10.194.22.16" priority 1  

 

STORE fxtest_aa ON "BJINMS216.BJ.COM" FAILTHRESHOLD 3 RETURN SERVICES OFF WHEN REPLICATION STOPPED      

DISABLE RETURN SUBSCRIBER 50 DURABLE COMMIT OFF RETURN WAIT TIME 3 

STORE fxtest_bb ON "bjinms221.bj.com" FAILTHRESHOLD 3 RETURN SERVICES OFF WHEN REPLICATION STOPPED

DISABLE RETURN SUBSCRIBER 50 DURABLE COMMIT OFF RETURN WAIT TIME 3;

 

2A機器:

$ ttisql fxtest_aa

 

Copyright (c) 1996-2007, Oracle.  All rights reserved.

Type ? or "help" for help, type "exit" to quit ttIsql.

All commands must end with a semicolon character.

 

 

 

connect "DSN=fxtest_aa";

Connection successful: DSN=fxtest_aa;UID=times;DataStore=/ora/TimesTen/datastore/fxtest_aa;DatabaseCharacterSet=AL32UTF8;ConnectionCharacterSet=US7ASCII;LogFileSize=64;WaitForConnect=0;Preallocate=1;DRIVER=/ora/TimesTen/tt70/TimesTen/tt70/lib/libtten.so;MemoryLock=4;LogBuffSize=65536;Authenticate=0;Isolation=1;LogDir=/ora/TimesTen/datastore;PermSize=380;TempSize=20;PermWarnThreshold=75;TempWarnThreshold=75;LockWait=10;SQLQueryTimeout=0;LogFlushMethod=1;Connections=100;LogAutoTruncate=0;CkptRate=0;CkptFrequency=600;CkptLogVolume=0;RecoveryThreads=4;TypeMode=0;

(Default setting AutoCommit=1)

Command> CREATE REPLICATION fxtest.reptest

ELEMENT element_rep_aa datastore

> ELEMENT element_rep_aa datastore

MASTER fxtest_aa ON "BJINMS216.BJ.COM" TRANSMIT NONDURABLE      >

MASTER fxtest_aa ON "BJINMS216.BJ.COM" TRANSMIT NONDURABLE

> SUBSCRIBER fxtest_bb ON "bjinms221.bj.com" RETURN RECEIPT

> ROUTE MASTER fxtest_aa ON "BJINMS216.BJ.COM" SUBSCRIBER fxtest_bb ON "bjinms221.bj.com"

> MASTERIP "10.194.22.16" priority 1 SUBSCRIBERIP "10.194.22.18" priority 1

> ELEMENT element_rep_bb datastore

> MASTER fxtest_bb ON "bjinms221.bj.com" TRANSMIT NONDURABLE

MASTERIP "10.194.22.18" priority 1 SUBSCRIBERIP "10.194.22.16" priority 1

> SUBSCRIBER fxtest_aa ON "BJINMS216.BJ.COM" RETURN RECEIPT

> ROUTE MASTER fxtest_bb ON "bjinms221.bj.com" SUBSCRIBER fxtest_aa ON "BJINMS216.BJ.COM"

STORE fxtest_bb ON "bjinms221.bj.com" FAILTHRESHOLD 3 RETURN SERVICES OFF WHEN REPLICATION STOPPED

> MASTERIP "10.194.22.18" priority 1 SUBSCRIBERIP "10.194.22.16" priority 1

> STORE fxtest_aa ON "BJINMS216.BJ.COM" FAILTHRESHOLD 3 RETURN SERVICES OFF WHEN REPLICATION STOPPED

> DISABLE RETURN SUBSCRIBER 50 DURABLE COMMIT OFF RETURN WAIT TIME 3

> STORE fxtest_bb ON "bjinms221.bj.com" FAILTHRESHOLD 3 RETURN SERVICES OFF WHEN REPLICATION STOPPED

> DISABLE RETURN SUBSCRIBER 50 DURABLE COMMIT OFF RETURN WAIT TIME 3;

Command>

 

3B機器:

bjinms221.bj.com> ttisql fxtest_bb

 

Copyright (c) 1996-2007, Oracle.  All rights reserved.

Type ? or "help" for help, type "exit" to quit ttIsql.

All commands must end with a semicolon character.

 

 

 

connect "DSN=fxtest_bb";

Connection successful: DSN=fxtest_bb;UID=times;DataStore=/export/home/times/TimesTen/datastore/fxtest_bb;DatabaseCharacterSet=AL32UTF8;ConnectionCharacterSet=AL32UTF8;LogFileSize=64;WaitForConnect=0;Preallocate=1;DRIVER=/export/home/times/TimesTen/tt70/lib/libtten.so;MemoryLock=4;LogBuffSize=65536;Authenticate=0;Isolation=1;LogDir=/export/home/times/TimesTen/datastore;PermSize=380;TempSize=20;PermWarnThreshold=75;TempWarnThreshold=75;LockWait=10;SQLQueryTimeout=0;LogFlushMethod=1;Connections=100;LogAutoTruncate=0;CkptRate=0;CkptFrequency=600;CkptLogVolume=0;RecoveryThreads=4;NLS_NCHAR_CONV_EXCP=1;TypeMode=0;

(Default setting AutoCommit=1)

Command> CREATE REPLICATION fxtest.reptest

ELEMENT element_rep_aa datastore

> ELEMENT element_rep_aa datastore

MASTER fxtest_aa ON "BJINMS216.BJ.COM" TRANSMIT NONDURABLE

> MASTER fxtest_aa ON "BJINMS216.BJ.COM" TRANSMIT NONDURABLE

> SUBSCRIBER fxtest_bb ON "bjinms221.bj.com" RETURN RECEIPT

> ROUTE MASTER fxtest_aa ON "BJINMS216.BJ.COM" SUBSCRIBER fxtest_bb ON "bjinms221.bj.com"

> MASTERIP "10.194.22.16" priority 1 SUBSCRIBERIP "10.194.22.18" priority 1

> ELEMENT element_rep_bb datastore

> MASTER fxtest_bb ON "bjinms221.bj.com" TRANSMIT NONDURABLE

MASTERIP "10.194.22.18" priority 1 SUBSCRIBERIP "10.194.22.16" priority 1

> SUBSCRIBER fxtest_aa ON "BJINMS216.BJ.COM" RETURN RECEIPT

> ROUTE MASTER fxtest_bb ON "bjinms221.bj.com" SUBSCRIBER fxtest_aa ON "BJINMS216.BJ.COM"

STORE fxtest_bb ON "bjinms221.bj.com" FAILTHRESHOLD 3 RETURN SERVICES OFF WHEN REPLICATION STOPPED

> MASTERIP "10.194.22.18" priority 1 SUBSCRIBERIP "10.194.22.16" priority 1

> STORE fxtest_aa ON "BJINMS216.BJ.COM" FAILTHRESHOLD 3 RETURN SERVICES OFF WHEN REPLICATION STOPPED

> DISABLE RETURN SUBSCRIBER 50 DURABLE COMMIT OFF RETURN WAIT TIME 3

> STORE fxtest_bb ON "bjinms221.bj.com" FAILTHRESHOLD 3 RETURN SERVICES OFF WHEN REPLICATION STOPPED

> DISABLE RETURN SUBSCRIBER 50 DURABLE COMMIT OFF RETURN WAIT TIME 3;

Command>

 

Step 3, 啟動replication Agent

 

1A機器:

$ ttAdmin -repStart fxtest_aa

RAM Residence Policy            : inUse

Replication Agent Policy        : manual

Replication Manually Started    : True

Cache Agent Policy              : manual

Cache Agent Manually Started    : False

 

2B機器:

bjinms221.bj.com> ttAdmin -repStart fxtest_bb

RAM Residence Policy            : inUse

Replication Agent Policy        : manual

Replication Manually Started    : True

Cache Agent Policy              : manual

Cache Agent Manually Started    : False

 

Step by Step TimesTen --- DataStore的雙向複製( 二)參見  http://space.itpub.net/81/viewspace-429796

 

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

相關文章