Базы данных Oracle - статьи

         

Конфигурирование Active-Standby pair репликации и Oracle Clusterware


Ограничения: В данном примере описывается создание простой конфигурации (basic level of availability).

Вначале добавим сущность в cluster.oracle.ini, в которой пропишем узлы, на которых будет запущена репликация, и директорию для CRS-скриптов (check, start, stop) для определенной репликации). … [ha_ds] MasterHosts=rac1,rac2 ScriptInstallDir=/u01/app/oracle/product/11.2.1/TimesTen/tt1/info/crs_scripts …

Теперь нужно повторить настройки cluster.oracle.ini и sys.odbc.ini на втором узле (rac2). 
Далее регистрируем TimesTen кластер в OCR.

[root@rac1 ~]$ cd /u01/app/oracle/product/11.2.1/TimesTen/tt1/bin/

[root@rac1 bin]$ ./ttCWAdmin -ocrconfig

Oracle Clusterware home = /u01/app/oracle/product/11.1.0/crs

Далее запускаем агенты кластера TimesTen на обоих узлах. [root@rac1 bin]$ ./ttCWAdmin -init

Oracle Clusterware home = /u01/app/oracle/product/11.2.1/crs, hosts = rac1,rac2 =============================================================== Registering agent resources:... Registration complete. =============================================================== =============================================================== Registering daemon resources:... Registration complete. ===============================================================

После этого в CRS должны появиться четыре новых сервиса.

[oracle@rac1 ~]$ crs_stat -t

Name Type Target State Host ------------------------------------------------------------ TT_A...le_RAC1 application ONLINE ONLINE rac1

TT_A...le_RAC2 application ONLINE ONLINE rac2

TT_D...le_RAC1 application ONLINE ONLINE rac1

TT_D...le_RAC2 application ONLINE ONLINE rac2

ora.rac1.gsd application ONLINE ONLINE rac1 ora.rac1.ons application ONLINE ONLINE rac1 ora.rac1.vip application ONLINE ONLINE rac1 ora.rac2.gsd application ONLINE ONLINE rac2 ora.rac2.ons application ONLINE ONLINE rac2 ora.rac2.vip application ONLINE ONLINE rac2 [oracle@rac1 ~]$

[oracle@rac1 ~]$ crs_stat



… NAME=TT_Agent_tt1_oracle_RAC1 TYPE=application TARGET=ONLINE STATE=ONLINE on rac1 NAME=TT_Agent_tt1_oracle_RAC2 TYPE=application TARGET=ONLINE STATE=ONLINE on rac2 NAME=TT_Daemon_tt1_oracle_RAC1 TYPE=application TARGET=ONLINE STATE=ONLINE on rac1 NAME=TT_Daemon_tt1_oracle_RAC2 TYPE=application TARGET=ONLINE STATE=ONLINE on rac2 …


Также видим новые процессы на обоих узлах.

[oracle@rac2 ~]$ ps -ef | grep ttCRS

oracle 5007 1 0 13:18 ? 00:00:00 /u01/app/oracle/product/11.2.1/TimesTen/tt1/bin/ttCRSdaemonCmd start oracle 5008 1 0 13:18 ? 00:00:00 /u01/app/oracle/product/11.2.1/TimesTen/tt1/bin/ttCRSAgentCmd start

Теперь создадим Active-Standby pair репликацию. Данную репликацию можно создать двумя способами: используя команду create active standby pair replication или с помощью ttCWAdmin, но не обоими одновременно! В данном случае создавать и управлять репликацией будем с помощью ttCWAdmin. При запросе имени пользователя с привилегией ADMIN вводим имя adm (создан на этапе создания базы данных и объектов). [root@rac1 bin]$ ./ttCWAdmin -create -dsn ha_ds

Successful connection with Oracle clusterware stack replication DDL = create active standby pair "HA_DS" on "rac1","HA_DS" on "rac2" Enter internal UID with ADMIN privileges: adm Enter password for the same UID: Enter any phrase for password encryption: Uid/Pwd verified on host rac1 Create active standby pair scheme on this host? (Y/N)Y Waiting for confirmation from hosts... Active Standby pair created on host rac1 ================================================================== Warning!! Data store on host(s) rac2 may be destroyed in order to be duplicated from active after the roll out. Please back up this data store manually if necessary, before executing ttCWAdmin -start Command ================================================================== Registering TimesTen Cluster with Oracle Clusterware ================================================================== Number of unregistered dsn resources = 2 Registering dsn resources:... Registration complete. ================================================================== ================================================================== Number of unregistered service resources = 2 Registering service resources:... Registration complete. ================================================================== [root@rac1 bin]$



После этого в CRS появятся еще четыре сервиса, связанные непосредственно с репликацией HA_DS. Также можно заметить, что два из них не запущены - имеют статусы OFFLINE.

[oracle@rac1 info]$ crs_stat -t

Name Type Target State Host ------------------------------------------------------------ TT_A...e_HA_DS application ONLINE ONLINE rac1

TT_A...le_RAC1 application ONLINE ONLINE rac1 TT_A...le_RAC2 application ONLINE ONLINE rac2 TT_D...le_RAC1 application ONLINE ONLINE rac1 TT_D...le_RAC2 application ONLINE ONLINE rac2 TT_M...HA_DS_0 application OFFLINE OFFLINE

TT_M...HA_DS_1 application OFFLINE OFFLINE

TT_S...e_HA_DS application ONLINE ONLINE rac1

ora.rac1.gsd application ONLINE ONLINE rac1 ora.rac1.ons application ONLINE ONLINE rac1 ora.rac1.vip application ONLINE ONLINE rac1 ora.rac2.gsd application ONLINE ONLINE rac2 ora.rac2.ons application ONLINE ONLINE rac2 ora.rac2.vip application ONLINE ONLINE rac2 [oracle@rac1 info]$

[oracle@rac1 ~]$ crs_stat

… NAME=TT_Activeservice_tt1_oracle_HA_DS TYPE=application TARGET=ONLINE STATE=ONLINE on rac1 NAME=TT_Master_tt1_oracle_HA_DS_0 TYPE=application TARGET=OFFLINE STATE=OFFLINE NAME=TT_Master_tt1_oracle_HA_DS_1 TYPE=application TARGET=OFFLINE STATE=OFFLINE NAME=TT_Subservice_tt1_oracle_HA_DS TYPE=application TARGET=ONLINE STATE=ONLINE on rac1 …

Также после этого в директории, прописанной в файле конфигурации репликации (cluster.oracle.ini), появится ряд CRS-файлов (start, stop, check) для определенной репликации. [oracle@rac2 crs_scripts]$ ls

... ora_tt_tt1_HA_DS_master_1.sh ora_tt_tt1_HA_DS_master_0.sh ora_tt_tt1_HA_DS_activeservice.sh ora_tt_tt1_HA_DS_subservice.sh

Теперь посмотрим состояние репликации. [root@rac1 bin]# ./ttCWAdmin -status

TimesTen Cluster status report as of Wed Apr 14 17:00:19 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: NOT RUNNING Monitor Process for Master Datastore 2 on Host RAC2: NOT RUNNING Monitor Process for Active datastore:RUNNING on Host rac1 Monitor Process for Standby datastore:RUNNING on Host rac1

2.Status of Datastores comprising the cluster Master Datastore 1: Host:RAC1 Status:AVAILABLE State:ACTIVE Master Datastore 2: Host:RAC2 Status:UNAVAILABLE State:UNKNOWN ==================================================================== The cluster containing the replicated DSN is offline

Видим, что агенты кластера Oracle TimesTen запущены, репликация существует, но она не запущена. Теперь запустим нашу репликацию. [root@rac1 bin]$ ./ttCWAdmin -start -dsn ha_ds

Successful connection with Oracle clusterware stack Starting Cluster resources with Oracle clusterware TimesTen Cluster is starting [root@rac1 bin]$

Проверим статус репликации. [root@rac1 bin]$ ./ttCWAdmin –status

TimesTen Cluster status report as of Sat Feb 27 14:49:00 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

Видно, что реплицируемая база данных находится в состоянии online. Узлы находятся в состояниях Active и Standby. Проверим CRS. [oracle@rac1 info]# crs_stat -t

Name Type Target State Host ------------------------------------------------------------ TT_A...e_HA_DS application ONLINE ONLINE rac1 TT_A...le_RAC1 application ONLINE ONLINE rac1 TT_A...le_RAC2 application ONLINE ONLINE rac2 TT_D...le_RAC1 application ONLINE ONLINE rac1 TT_D...le_RAC2 application ONLINE ONLINE rac2 TT_M...HA_DS_0 application ONLINE ONLINE rac1 TT_M...HA_DS_1 application ONLINE ONLINE rac2 TT_S...e_HA_DS application ONLINE ONLINE rac1 ora.rac1.gsd application ONLINE ONLINE rac1 ora.rac1.ons application ONLINE ONLINE rac1 ora.rac1.vip application ONLINE ONLINE rac1 ora.rac2.gsd application ONLINE ONLINE rac2 ora.rac2.ons application ONLINE ONLINE rac2 ora.rac2.vip application ONLINE ONLINE rac2

Видно, что все сервисы находятся в рабочем состоянии. На этом конфигурация Active-Standby pair репликации завершена.


Содержание раздела