Проверка работы конфигурации
Посмотрим на текущее состояние конфигурации. [root@rac1 bin]# ./ttCWAdmin -status
TimesTen Cluster status report as of Fri Sep 3 15:54:23 2010 ==================================================================== TimesTen daemon monitors: Host:RAC1 Status: online Host:RAC2 Status: online ==================================================================== ==================================================================== TimesTen Cluster agents Host:RAC1 Status: online Host:RAC2 Status: online ==================================================================== Status of Cluster related to DSN HA_DS: ==================================================================== 1. Status of Cluster monitoring components: Monitor Process for Master Datastore 1 on Host rac1: RUNNING Monitor Process for Master Datastore 2 on Host rac2: RUNNING Monitor Process for Active datastore:RUNNING on Host rac1 Monitor Process for Standby datastore:NOT RUNNING 2.Status of Datastores comprising the cluster Master Datastore 1: Host:rac1 Status:AVAILABLE State:ACTIVE Master Datastore 2: Host:rac2 Status:AVAILABLE State:STANDBY ==================================================================== The cluster containing the replicated DSN is offline
Подсоединимся к узлу, имеющему состояние active, и вставим ряд записей в таблицу plans.
[oracle@rac1 ~]$ ttisql "DSN=ha_ds;UID=app;PWD=app"
Copyright (c) 1996-2009, Oracle. All rights reserved. Type ? or "help" for help, type "exit" to quit ttIsql. connect "DSN=ha_ds;UID=app;PWD=app"; Connection successful: DSN=ha_ds;UID=app;DataStore=/u01/app/oracle/datastore/ha_ds;DatabaseCharacterSet=AL32UTF8;ConnectionCharacterSet=US7ASCII;DRIVER=/u01/app/oracle/product/11.2.1/TimesTen/tt1/lib/libtten.so;PermSize=40;TempSize=32;TypeMode=0; (Default setting AutoCommit=1) Command> call ttRepStateGet();
< ACTIVE >
1 row found. Command> select count(*) from plans;
< 0 > 1 row found. Command> declare
>
i number :=1 ;
>
begin
>
for i in 1 .. 1000 loop
>
insert into plans (ID, NAME, PRICEPERMIN, STATUS)
>
values (i, 'test', 1, 'ACT');
>
end loop;
>
end;
> / PL/SQL procedure successfully completed. Command>
select count(*) from plans; < 1000 > 1 row found. Command>
Теперь посмотрим состояние базы данных на узле rac2. [oracle@rac2 ~]$
ttisql "DSN=ha_ds;UID=app;PWD=app"
Copyright (c) 1996-2009, Oracle. All rights reserved. Type ? or "help" for help, type "exit" to quit ttIsql. connect "DSN=ha_ds;UID=app;PWD=app"; Connection successful: DSN=ha_ds;UID=app;DataStore=/u01/app/oracle/datastore/ha_ds;DatabaseCharacterSet=AL32UTF8;ConnectionCharacterSet=US7ASCII;DRIVER=/u01/app/oracle/product/11.2.1/TimesTen/tt1/lib/libtten.so;PermSize=40;TempSize=32;TypeMode=0; (Default setting AutoCommit=1) Command>
call ttRepStateGet();
< STANDBY >
1 row found. Command>
select count(*) from plans;
< 1000 > 1 row found. Command>
Видим, что узел, находящийся в состоянии Standby, принимает информацию с узла rac1 и также доступен на чтение. Попытаемся вставить строки в таблицу plans на данном узле. Command>
insert into plans (ID, NAME, PRICEPERMIN, STATUS)
>
values (0, 'test', 2, 'ACT');
16265: This store is currently the STANDBY. Change to APP.PLANS not permitted. The command failed. Command>
При попытке изменения данных получаем ошибку 16265.
Теперь воспроизведем ситуацию выхода из строя одного из серверов. Для этого выполним на узле rac1 команду reboot
![root@rac1 ~]#
reboot
Посмотрим состояние репликации на узле rac2.
[root@rac2 ~]#
cd /u01/app/oracle/product/11.2.1/TimesTen/tt1/bin
[root@rac2 bin]#
./ttCWAdmin -status
TimesTen Cluster status report as of Tue Sep 14 20:25:12 2010 ==================================================================== TimesTen daemon monitors: Host:RAC1 Status: unavailable Host:RAC2 Status: online ==================================================================== ==================================================================== TimesTen Cluster agents Host:RAC1 Status: unavailable Host:RAC2 Status: online ==================================================================== Status of Cluster related to DSN HA_DS: ==================================================================== 1. Status of Cluster monitoring components: Monitor Process for Master Datastore 1 on Host RAC1: NOT RUNNING (ttCWAdmin) crsctl.c(21567): TT48004: clssgspubdata failed with status = 12. Monitor Process for Master Datastore 2 on Host rac2: RUNNING Monitor Process for Active datastore:RUNNING on Host rac2 Monitor Process for Standby datastore:RUNNING on Host rac2 2.Status of Datastores comprising the cluster Master Datastore 1: Host:RAC1 Status:UNAVAILABLE State:UNKNOWN Master Datastore 2: Host:rac2 Status:AVAILABLE State:ACTIVE ==================================================================== The cluster containing the replicated DSN is offline
Следовательно, Oracle Clusterware перевело узел rac2 из состояния «Standby» в состояние «Active», и пользователи могут продолжить работу на узле rac2. Также можно заметить, что узел rac1 не доступен, так как он перезагружается. После завершения данного процесса, ситуация принимает следующий вид.
[root@rac2 bin]#
./ttCWAdmin -status
TimesTen Cluster status report as of Tue Sep 14 20:49:16 2010 ==================================================================== TimesTen daemon monitors: Host:RAC1 Status: online Host:RAC2 Status: online ==================================================================== ==================================================================== TimesTen Cluster agents Host:RAC1 Status: online Host:RAC2 Status: online ==================================================================== Status of Cluster related to DSN HA_DS: ==================================================================== 1. Status of Cluster monitoring components: Monitor Process for Master Datastore 1 on Host rac1: RUNNING Monitor Process for Master Datastore 2 on Host rac2: RUNNING Monitor Process for Active datastore:RUNNING on Host rac2 Monitor Process for Standby datastore:RUNNING on Host rac1 2.Status of Datastores comprising the cluster Master Datastore 1: Host:rac1 Status:AVAILABLE State:STANDBY Master Datastore 2: Host:rac2 Status:AVAILABLE State:ACTIVE ==================================================================== The cluster containing the replicated DSN is online
Кроме этого, можно делать переключения ролей между узлами.
[root@rac2 bin]#
./ttCWAdmin -switch -dsn ha_ds
Successful connection with crs clusterware stack Swithing Active/Standby roles for the scheme of DSN HA_DS Current active host rac2 Current standby host rac1 TimesTen Cluster is starting Active standby roles are switched successfully [root@rac2 bin]#
./ttCWAdmin -status
TimesTen Cluster status report as of Tue Sep 14 20:52:07 2010 ==================================================================== TimesTen daemon monitors: Host:RAC1 Status: online Host:RAC2 Status: online ==================================================================== ==================================================================== TimesTen Cluster agents Host:RAC1 Status: online Host:RAC2 Status: online ==================================================================== Status of Cluster related to DSN HA_DS: ==================================================================== 1. Status of Cluster monitoring components: Monitor Process for Master Datastore 1 on Host rac1: RUNNING Monitor Process for Master Datastore 2 on Host rac2: RUNNING Monitor Process for Active datastore:RUNNING on Host rac1 Monitor Process for Standby datastore:RUNNING on Host rac2 2.Status of Datastores comprising the cluster Master Datastore 1: Host:rac1 Status:AVAILABLE State:ACTIVE Master Datastore 2: Host:rac2 Status:AVAILABLE State:STANDBY ==================================================================== The cluster containing the replicated DSN is online
Следовательно, мы получили достаточно надежную и работающую конфигурацию с использованием Oracle TimesTen.
Содержание раздела