前回はHADBをマシンにインストールしてみました。今回はインストールしたHADB上にドメインとDBを作成して
HADBをFaultTorelant状態に持っていくまでを説明します。
(まだ、1つのマシンにしかノードは作成しません)

[参考:HADBの対障害ステータスについて]
以下の6つのステータスのどれかになります。
・HAfaultTolerant
・FaultTolerant
・Operational
・Non Operational
・Stopped
・Unknown

[各ステータスの説明]
・HAfaultTolerant
DBはフォールトトレラント(対障害状態)にあり、スペアノードがDRU(冗長ユニット)1つにつき最低1つあります。
スペアノードがあると、ノードのペアのうちどちらかが破壊されてもOperational状態に落ちずに
破壊されたノードの代わりにスペアノードが本ノードに「昇格」してサービスを続けます。
スペアを全て使ってしまった場合はHADBのステータスはFaultTolerantになります。

・FaultTolerant
DRUの全てのミラーノードのペアが正常に稼動している状態です。FaultTolerant状態ではどこかのノードに障害が発生するとペアを維持できなくなりますが、サービス自体には影響はありません。FaultTolerant状態で片方のノードに障害が起きた場合はHADBのステータスはOperationalとなります。

・Operational
ミラーノードのどちらか一方だけ稼動している状態です。この状態のまま稼動中のノード(既に相方を失っている)がクラッシュするとサービスが停止してしまいます。早急にFaultTolerantより上の状態に戻す必要があります。

・Non Operational
DRU間でノードのペアが丸ごとダウンしている状態です。この状態ではDBはサービスを行うことができません。

・Stopped
DB中で稼動しているノードが1つも存在しない状態です。DB起動前または、hadbm stopコマンドが完了するとこの状態になります。

・Unknown
状態が不明の場合です。

#今回の設定ですと同じマシンにDRUを2つインストールしてしまうので、HADBをインストールしたマシンがクラッシュするとHADBのサービスを継続することができなくなります。
マシンのクラッシュではなく、片方のノードのプロセス障害の場合はHADBは何ら問題なくサービスを提供することができます。
次回、他の物理マシンにもノードを追加して片方のマシンクラッシュに対応できる構成を説明します。

[設定概要]
0.マネージメントエージェントの起動
1.HADBドメインを作成
2.DBをドメイン中に作成
3.SQLでのテスト

0.MAがインストール・起動していなければインストールと起動
windows

cd C:\Sun\HADB\hadb\4.4.3-6\bin
ma -i ma.cfg
net start HADBMgmtAgent

solaris

cd /opt/SUNWappserver/hadb/4/bin
./ma-initd start

マネージメントエージェントとは、HADBの各ノードの管理と監視を行うプロセスです。hadbmコマンドを発行する場合はMAを起動しておく必要があります。

1.マネージメントドメインの作成
windows

hadbm createdomain --adminpassword=adminadmin localhost

solaris

./hadbm createdomain --adminpassword=adminadmin 129.158.34.188

マネージメントドメインはどのホストにDBノードを載せることができるかを管理しています。ノードを作成したい全てのホスト名/IPアドレスがマネージメントドメインに含まれている必要があります。(作成後にhadbm extenddomainコマンドでホストを増やすこともできます)

2.DBの作成

windows

hadbm create --devicesize 1024 --hosts testhost1,testhost1

solaris

./hadbm create --devicesize 1024 --hosts 129.158.34.188,129.158.34.188

--hostsには、HADBのノードをどのホスト(マシン)に作成するかを指定します。
今回は最初の設定ですので、同一マシンに2つのDRUを載せるように設定してみます。この場合は同じホスト名を2回、カンマで区切って指定します。(4つ指定したい場合は4つホスト名をカンマで区切って指定します)。ノードはかならず2以上の偶数で指定する必要があります。

-bash-3.00# ./hadbm create --devicesize 1024 --hosts 129.158.34.188,129.158.34.188
Please enter the password for the database system user:***********
Please retype the password for database system user:***********
WARNING: The --dbpassword option is deprecated since it is insecure. Using this option can compromise your password. Please use either the command prompt or the --dbpasswordfile option.
Please enter the password for the admin system user:***********
2007-09-22 15:59:48.145 INFO    hadbm create --devicesize=1024 --hosts=129.158.34.188,129.158.34.188 --datadevices=1 --no-cleanup=false --no-clear=false --quiet=false --version=false --yes=false --force=false --echo=false --dbpassword=******
2007-09-22 16:00:03.322 INFO    Initializing device /opt/SUNWappserver/hadb/4.4.3-6/device/hadb.data-0.1 for node hadb:1
2007-09-22 16:00:03.323 INFO    Initializing device /opt/SUNWappserver/hadb/4.4.3-6/device/hadb.noman.1 for node hadb:1
2007-09-22 16:00:03.323 INFO    Initializing device /opt/SUNWappserver/hadb/4.4.3-6/device/hadb.relalg.1 for node hadb:1
2007-09-22 16:00:03.324 INFO    Initializing device /opt/SUNWappserver/hadb/4.4.3-6/device/hadb.nilog.1 for node hadb:1
2007-09-22 16:00:03.331 INFO    Initializing device /opt/SUNWappserver/hadb/4.4.3-6/device/hadb.noman.0 for node hadb:0
2007-09-22 16:00:03.383 INFO    Initializing device /opt/SUNWappserver/hadb/4.4.3-6/device/hadb.data-0.0 for node hadb:0
2007-09-22 16:00:03.425 INFO    Initializing device /opt/SUNWappserver/hadb/4.4.3-6/device/hadb.nilog.0 for node hadb:0
2007-09-22 16:00:03.450 INFO    Initializing device /opt/SUNWappserver/hadb/4.4.3-6/device/hadb.relalg.0 for node hadb:0
2007-09-22 16:00:39.767 INFO    Starting node hadb:1 at level firststart, config version 1, in order to start database
2007-09-22 16:00:39.796 INFO    n:1 NSUP   INF 2007-09-22 16:00:39.795 p:4417 Legal realtime priorities are 0 (lowest) to 59 (highest) set it to:29
2007-09-22 16:00:42.431 INFO    Starting node hadb:0 at level firststart, config version 1, in order to start database
2007-09-22 16:00:42.492 INFO    n:0 NSUP   INF 2007-09-22 16:00:42.491 p:4420 Legal realtime priorities are 0 (lowest) to 59 (highest) set it to:29
Database hadb successfully created and started.

db名をhadbで作成する場合

./hadbm create --devicesize 1024 --hosts 129.158.34.188,129.158.34.188

db名をhastoreで作成する場合

-bash-3.00# ./hadbm create --devicesize 1024 --hosts 129.158.34.188,129.158.34.188 hastore
Please enter the password for the database system user:***********
Please retype the password for database system user:***********
WARNING: The --dbpassword option is deprecated since it is insecure. Using this option can compromise your password. Please use either the command prompt or the --dbpasswordfile option.
Please enter the password for the admin system user:***********
2007-09-22 16:11:13.303 INFO    hadbm create --devicesize=1024 --hosts=129.158.34.188,129.158.34.188 --datadevices=1 --no-cleanup=false --no-clear=false --quiet=false --version=false --yes=false --force=false --echo=false --dbpassword=****** hastore
2007-09-22 16:11:28.130 INFO    Initializing device /opt/SUNWappserver/hadb/4.4.3-6/device/hastore.nilog.0 for node hastore:0
2007-09-22 16:11:28.130 INFO    Initializing device /opt/SUNWappserver/hadb/4.4.3-6/device/hastore.relalg.0 for node hastore:0
2007-09-22 16:11:28.131 INFO    Initializing device /opt/SUNWappserver/hadb/4.4.3-6/device/hastore.noman.0 for node hastore:0
2007-09-22 16:11:28.131 INFO    Initializing device /opt/SUNWappserver/hadb/4.4.3-6/device/hastore.data-0.0 for node hastore:0
2007-09-22 16:11:28.155 INFO    Initializing device /opt/SUNWappserver/hadb/4.4.3-6/device/hastore.noman.1 for node hastore:1
2007-09-22 16:11:28.156 INFO    Initializing device /opt/SUNWappserver/hadb/4.4.3-6/device/hastore.relalg.1 for node hastore:1
2007-09-22 16:11:28.198 INFO    Initializing device /opt/SUNWappserver/hadb/4.4.3-6/device/hastore.nilog.1 for node hastore:1
2007-09-22 16:11:28.250 INFO    Initializing device /opt/SUNWappserver/hadb/4.4.3-6/device/hastore.data-0.1 for node hastore:1
2007-09-22 16:12:04.795 INFO    Starting node hastore:0 at level firststart, config version 1, in order to start database
2007-09-22 16:12:04.833 INFO    n:0 NSUP   INF 2007-09-22 16:12:04.833 p:5055 Legal realtime priorities are 0 (lowest) to 59 (highest) set it to:29
2007-09-22 16:12:07.033 INFO    Starting node hastore:1 at level firststart, config version 1, in order to start database
2007-09-22 16:12:07.060 INFO    n:1 NSUP   INF 2007-09-22 16:12:07.060 p:5060 Legal realtime priorities are 0 (lowest) to 59 (highest) set it to:29
Database hastore successfully created and started.

DBの作成が完了したら、HADBデータベースを起動します。
hadbm start データベース名
./hadbm start hastore

HADBデータベースを停止する必要がある場合は停止コマンドを入力します。
hadbm stop データベース名

./hadbm stop hastore

以下のコマンドでHADBの各種設定を照会することができます。

-bash-3.00# ./hadbm get --all hastore
Please enter the password for the admin system user:***********
2007-09-22 16:15:32.138 INFO    hadbm get --all=true --quiet=false --version=false --yes=false --force=false --echo=false hastore
Attribute             Value
ConnectionTrace       false
CoreFile              false
DataBufferPoolSize    200
DataDeviceSize        1024
DevicePath            /opt/SUNWappserver/hadb/4.4.3-6/device
EagerSessionThreshold 50
EagerSessionTimeout   120
EventBufferSize       0
HistoryPath           /opt/SUNWappserver/hadb/4.4.3-6/history
InternalLogBufferSize 12
JdbcUrl               jdbc:sun:hadb:129.158.34.188:15005,129.158.34.188:15025
LogBufferSize         48
MaxTables             1100
NumberOfDataDevices   1
NumberOfLocks         50000
NumberOfSessions      100
PackageName           V4.4.3.6
PortBase              15000
RelAlgDeviceSize      128
SessionTimeout        1800
SQLTraceMode          none
StartRepairDelay      20
StatInterval          600
SysLogFacility        local0
SysLogLevel           WARNING
SysLogPrefix          hadb-hastore
TakeoverTime          10000

HADB内に定義されているドメインを照会してみましょう。

-bash-3.00# ./hadbm listdomain
Please enter the password for the admin system user:***********
2007-09-22 16:19:01.400 INFO    hadbm listdomain --quiet=false --version=false --yes=false --force=false --echo=false
Hostname                         Enabled? Running? Release  Interfaces
testhost1.japan.sun.com Yes      Yes      V4-4-3-6 129.158.34.188

hadbm statusコマンドにて、hadbのサービスの状態を照会することができます。

-bash-3.00# ./hadbm status hastore
Please enter the password for the admin system user:***********
2007-09-22 16:20:30.024 INFO    hadbm status --nodes=false --quiet=false --version=false --yes=false --force=false --echo=false hastore
Database Status
hastore  FaultTolerant

./hadbm get --all hastoreの結果から、JDBCURLを取得する
以下の部分にノードのホスト名/IP:ポート番号が出力されています。
後ほど、MQ側でHADBに接続するときに必要になる文字列です。

JdbcUrl               jdbc:sun:hadb:129.158.34.188:15005,129.158.34.188:15025

[HADBのテスト]

HADBが正常に設定され、DBが作成されてアクセス可能かをテストしてみます。
clusqlユーティリティを使用します。

[clusqlについて]
hadbmには、SQLコマンドインターフェイスとして、clusqlユーティリティが添付されています。
#Oracleで言うところのSQLPlus、Java DBで言うところのIJに相当するものです(詳細機能は違いますが)

hadbmユーティリティがあるのと同じディレクトリへ移動して以下のコマンドを発行します。

./clusql ホスト名:ポート番号(hadbm get --all hastoreで表示されたJDBCURL)

ユーザ名:system
パスワード(デフォルトを変更していない場合):adminadmin

-bash-3.00# ./clusql 129.158.34.188:15025
User name : system
Password  :
SQL: select * from sysroot.alltables;

   schemaid     tableid schemaname                       tablename

          0         302 sysroot                          systbldsc
          0         303 sysroot                          systbldef
          0         304 sysroot                          systbt
          0         308 sysroot                          syslnk
          0         309 sysroot                          syshgh
          0         310 sysroot                          sysacc
          0         104 sysroot                          krnprocedures
          0         105 sysroot                          krnnodes
          0         109 sysroot                          krnnodegroupnodes
          0         301 sysroot                          systbl
          0         305 sysroot                          systbtatt
          0         306 sysroot                          systbtdef
          0         307 sysroot                          sysusr
          0         311 sysroot                          sysnix
          0         312 sysroot                          sysviw
          0         313 sysroot                          sysviwcol
          0         101 sysroot                          krntables
          0         102 sysroot                          krnfragments
          0         103 sysroot                          krnreplicas
          0         106 sysroot                          krnredundancyunits
          0         107 sysroot                          krnsites
          0         108 sysroot                          krnnodegroups

HADB-I-11930: Selected 22 row(s)

これでHADBの設定は完了です。
管理ドメインが作成され、hastoreというDBがMQの永続ストア用に用意されました。
次回はMQ4.1をこのHADBを永続ストアに利用するように設定してみます。

投稿されたコメント:

コメント
コメントは無効になっています。

This blog copyright 2009 by naokitakemura