TimesTen Application Layer Database Cache learning: 17. High availability of the global data cache (cache grid)

Source: Internet
Author: User
Tags dsn

Overview

This article has two purposes:
1. Introduction to the high availability of the TimesTen Global Cache grid
2. A simple process to establish and clean up the global cache grid is given, and there is an article in front of it: TimesTen Application Layer Database Cache learning: 13. Global data cache (cache grid), but the cache group is too complex

Create a simple global Cache Grid

First set up two TimesTen instance, one for tt1122 and one for ttnew.
The reason why two instances are established is to stop instance convenience. No method has been found to stop the db at this time.

The detailed procedure is as follows:
On the tt1122 instance, establish the DSN for the CACHEDB1

[cachedb1]   Driver=/home/oracle/timesten/tt1122/lib/libtten.so   datastore=/home/oracle/timesten/tt1122/info/demodatastore/ CACHEDB1   permsize=    tempsize=    logfilesize= 32    logbufmb=32    databasecharacterset=al32utf8   oraclenetservicename=TTORCL    

On Ttnew instances, establish DSN for CACHEDB2

[cachedb2]   Driver=/home/oracle/timesten/tt1122/lib/libtten.so   datastore=/home/oracle/timesten/tt1122/info/demodatastore/ CACHEDB2   permsize=    tempsize=    logfilesize= 32    logbufmb=32    databasecharacterset=al32utf8   oraclenetservicename=TTORCL    

Create a schema user in CACHEDB1

set‘cachedb1> ‘createbyto tthr;

Set the CACHEADM user name and password in CACHEDB1 and CACHEDB2

-connstr"dsn=cachedb1;uid=tthr;pwd=tthr;oraclepwd=tthr"-cacheUidPwdSet-cacheUid-cachePwd oracle

Create a cache grid on CACHEDB1

"set prompt ‘cachedb1> ‘""dsn=cachedb1;uid=tthr;pwd=tthr;oraclepwd=oracle"call ttGridCreate (‘samplegrid‘);call ttGridInfo;< SAMPLEGRID, CACHEADM, Linux x86-64641122call ttGridNameSet (‘samplegrid‘);

Start the cache agent on the CACHEDB1

-cacheStart cachedb1

To create a schema in Oracle:

$ sqlplus tthr/[email protected]create table a(id int, name varchar(32keyselectontointo a values(1‘beijing‘);into a values(2‘shanghai‘);into a values(3‘guangzhou‘);

Create global Dynamic Asynchronous Writethrough Cache Group on CACHEDB1

CREATE DYNAMIC ASYNCHRONOUS WRITETHROUGH GLOBAL CACHE GROUP "G_AWT"  FROM  "TTHR"."A" (    "ID"   NUMBER(38)        NOT NULL,    "NAME" VARCHAR2(32 BYTE),    PRIMARY KEY("ID")  )

Start the replication agent on CACHEDB1:

-repStart cachedb1

Attach the CACHEDB1 to the cache grid

$ ttisql-v1 - e "set prompt ' cachedb1> '" "Dsn=cachedb1;uid=tthr;pwd=tthr"Cachedb1>Call TTGRIDNODESTATUS;CACHEDB1>Call Ttgridattach (1,' CACHEDB1 ',' localhost ',9991); cachedb1>Call Ttgridnodestatus;<Samplegrid,1,1, T, localhost, samplegrid_cachedb1_1,127.0. 0. 1,9991,<NULL>,<NULL>,<NULL>,<NULL>,<NULL> >

Confirm that CACHEDB1 can access the data

$  "set prompt ‘cachedb1> ‘""dsn=cachedb1;uid=tthr;pwd=tthr;oraclepwd=oracle"selectfromselectfromwhere11, beijing >

Create a schema user in CACHEDB2

-v1-e"set prompt ‘cachedb2> ‘" cachedb2cachedb2>by tthr;User created.cachedb2>to tthr;

Set the cache Admin account information on the CACHEDB2, etc...

Ttadmin-connstr"Dsn=cachedb2;uid=tthr;pwd=tthr;oraclepwd=tthr"-cacheuidpwdset-cacheuid cacheadm-cachepwd oracle[[email protected] ~]$ ttisql-v1-e"set prompt ' cachedb2> '" "Dsn=cachedb2;uid=tthr;pwd=tthr;oraclepwd=oracle"Cachedb2>Pagerttgridinfo;< Samplegrid, Cacheadm, Linux x86- -, --bit, One,2,2>cachedb2>PagerTtgridnameset (' Samplegrid ');Cachedb2>PagerTtcachestart ();cachedb2> CREATE DYNAMIC asynchronous Writethrough GLOBAL CACHE GROUP"G_AWT"> From >"Tthr"."A"(>"ID"Number ( -) not NULL, >"NAME"VARCHAR2 ( +BYTE), > PRIMARY KEY ("ID") >);cachedb2>PagerTtrepstart ();cachedb2>PagerTtgridattach (1,' cachedb2 ', ' localhost ', 9992);Cachedb2>Pagerttgridnodestatus;< Samplegrid,1,1, T, localhost, samplegrid_cachedb1_1,127.0. 0. 1,9991, <NULL, <NULL, <NULL, <NULL, <NULL> >< Samplegrid,2,1, T, localhost, samplegrid_cachedb2_2,127.0. 0. 1,9992, <NULL, <NULL, <NULL, <NULL, <NULL> >cachedb1> autocommit0Cachedb1>PagerTtoptsetflag (' globalprocessing ', 1);Cachedb1>Select* FROM a;<2, Shanghai ><1, Beijing >cachedb1>SELECTID, Ttgriduserassignedname (), Ttgridmemberid () from A; <1, CACHEDB1,1><2, CACHEDB2,2>
What happens when a node in the Cache grid is abnormal

The above is the demonstration, all normal, the following look at the abnormal situation.

If a grid member downtime

[Email protected] ~]$ Ttdaemonadmin-StopTimesTen Daemon stopped. [Email protected] ~]$ Ttstatus cachedb1ttstatus:could notConnect toThe TimesTen daemon.IfThe TimesTen daemon is  notRunning, please start it byRunning"Ttdaemonadmin-start". [Email protected] ~]$ [[email protected] ~]$ TTISQL-V1-E"set prompt ' cachedb2> '" "Dsn=cachedb2;uid=tthr;pwd=tthr;oraclepwd=oracle"Cachedb2> Show Autocommit;autocommit =1( on) cachedb2>Select* froma;<2, Shanghai >cachedb2>Select* fromAwhereID =1;3333: Time Out waiting forA response fromMember Samplegrid_cachedb2_2 <-roughly one minute cachedb2> cachedb2> autocommit0;cachedb2>PagerTtoptsetflag (' globalprocessing ', 1);Cachedb2>Select* fromA; long time no out! Never come out!!!
Conclusion
    1. For each member of the Cache grid, if it is a single node, this schema is not elastic (Resilience). Data is not re-distributed, query operation times out or hang
    2. The protection of each member of the Cache grid is usually protected by active Standby pair, with each node needing a Standby, but the architecture is more
    3. The cache Grid (Global cache Group) applies fewer scenarios and has limitations on scalability.
    4. TimesTen will be released in the future 12 version, should be able to replace the current cache grid function.

TimesTen Application Layer Database Cache learning: 17. High availability of the global data cache (cache grid)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.