Hitachi

Cosminexus V11 アプリケーションサーバ 機能解説 運用/監視/連携編


19.4.4 クラスタの設定

クラスタに対して,次の設定を実施します。

〈この項の構成〉

(1) スクリプトファイルの作成

実行系のアプリケーションサーバを起動,停止するためのスクリプトファイルをVBScriptで記述します。実行系の各ノードで同一のスクリプトファイルを使用し,同一のパスに配置してください。

スクリプトファイルは汎用スクリプトをそのまま使用します。汎用スクリプトファイルの例については,「(2) 実行系の汎用スクリプトファイルの例」を参照してください。

ここでは,N:1リカバリシステムのシステムの監視対象および監視方法について説明します。

(a) 監視対象

アプリケーションサーバの1:1系切り替えシステムの監視対象を次に示します。

  • 運用管理エージェント

運用管理エージェントが終了したタイミングで系切り替えが実行されます。

(b) 監視方法

運用管理エージェントのプロセスの有無を監視します。監視するプロセスを次に示します。

  • adminagent.exe

(2) 実行系の汎用スクリプトファイルの例

N:1リカバリシステムの実行系で使用する汎用スクリプトファイルの例を次に示します。

Dim WshShell, fso, AccessInfoFile, oExec, oRun, oCosmiHome, oAdmin, oMngsvut, oCjsleep
Dim oMngHost, oUser, oPass
Set WshShell = CreateObject("WScript.Shell")
 
oCosmiHome = WshShell.ExpandEnvironmentStrings("%COSMINEXUS_HOME%")
oAdminac = """" & oCosmiHome & "\manager\bin\adminagentctl"""
oMngsvut = """" & oCosmiHome & "\manager\bin\mngsvrutil"""
oCjsleep = """" & oCosmiHome & "\CC\server\bin\cjsleep"""
 
oMngHost = "172.16.12.39" '--- Management Server
oUser = "admin" ' --- Management Server's userid
oPass = "admin" ' --- Management Server's password
 
'==== Open ====
Function Open( )
    Resource.LogInformation "======== Entering Open. ========"
    ' --- J2EE Server Name ---
    If Resource.PropertyExists("ServerName") = False Then
        Resource.LogInformation "### Private property ServerName is not set. ###"
    End If
    ' --- Inprocess OTS Status Path ---
    If Resource.PropertyExists("StatusPath") = False Then
        Resource.LogInformation "### Private property StatusPath is not set. ###"
    End If
    ' --- Cluster IP Address ---
    If Resource.PropertyExists("IPAddress") = False Then
        Resource.LogInformation "### Private property IPAddress is not set. ###"
    End If
    ' --- Cluster Host Name ---
    If Resource.PropertyExists("HostName") = False Then
        Resource.LogInformation "### Private property HostName is not set. ###"
    End If
    Open = True
End Function
 
'==== Online ====
Function Online( )
    Resource.LogInformation "======== Entering Online. ========"
 
    '--- private properties ---
    If Resource.PropertyExists("ServerName") = False Or _
       Resource.PropertyExists("StatusPath") = False Or _
       Resource.PropertyExists("IPAddress") = False Or _
       Resource.PropertyExists("HostName") = False Then
         Resource.LogInformation "### Private property is not set. ###"
         Online = False
         Exit Function
    End If
 
    '--- adminagentctl ---
    Set oExec = WshShell.Exec(oAdminac & " start")
    Do While oExec.Status = 0
        WshShell.Run oCjsleep & " 1", 0, True
    Loop
    If oExec.ExitCode <> 0 Then
        Resource.LogInformation "### Administration Agent cannot start. ### rtn=" & oResult
        Resource.LogInformation oExec.StdErr.ReadAll
        Online = False
        Exit Function
    End If
 
    '--- mngsvrutil ---
    oRun = oMngsvut & " -m "& oMngHost &":28080 -u " & oUser & " -p " & oPass & _
                      " -t " & Resource.HostName & " -k host -s start server"
    Set oExec = WshShell.Exec(oRun)
    Do While oExec.Status = 0
        WshShell.Run oCjsleep & " 1", 0, True
    Loop
    If oExec.ExitCode <> 0 Then
        Resource.LogInformation "### Logical Servers start failed. ### rtn=" & oResult
        Resource.LogInformation oExec.StdErr.ReadAll
        Online = False
        Exit Function
    End If
    Online = True
End Function
 
'==== LooksAlive ====
Function LooksAlive( )
    Resource.LogInformation "======== Entering LooksAlive. ========"
 
    '--- tasklist ---
    Set oExec = WshShell.Exec("tasklist /NH /FI ""IMAGENAME eq adminagent.exe""")
    Do While oExec.Status = 0
        WshShell.Run oCjsleep & " 1", 0, True
    Loop
 
    If InStr(1, oExec.StdOut.ReadAll, "adminagent.exe", 1) <> 0 Then
        LooksAlive = True
    Else
        LooksAlive = False
    End If
End Function
 
'==== IsAlive ====
Function IsAlive( )
    Resource.LogInformation "======== Entering IsAlive. ========"
 
    '--- mngsvrutil ---
    oRun = oMngsvut & " -m " & oMngHost & ":28080 -u " & oUser & " -p " & oPass & _
                      " -t " & Resource.HostName & " -k host check adminAgent"
    Set oExec = WshShell.Exec(oRun)
    Do While oExec.Status = 0
        WshShell.Run oCjsleep & " 1", 0, True
    Loop
    If oExec.ExitCode <> 0 Then
        Resource.LogInformation "### Administration Agent command failed. ### rtn=" & oExec.ExitCode
        Resource.LogInformation oExec.StdErr.ReadAll
        IsAlive = False
    Else
        IsAlive = True
    End If
End Function
 
'==== Offline ====
Function Offline( )
    Resource.LogInformation "======== Entering Offline. ========"
 
    '--- mngsvrutil ---
    oRun = oMngsvut & " -m " & oMngHost & ":28080 -u " & oUser & " -p " & oPass & _
                      " -t " & Resource.HostName & " -k host -s stop server"
    Set oExec = WshShell.Exec(oRun)
    Do While oExec.Status = 0
        WshShell.Run oCjsleep & " 1", 0, True
    Loop
    If oExec.ExitCode <> 0 Then
        Resource.LogInformation "### Logical Server stopping failed. ### rtn=" & oResult
        Resource.LogInformation oExec.StdErr.ReadAll
        Offline = False
        Exit Function
    End If
 
    '--- adminagentctl ---
    Set oExec = WshShell.Exec(oAdminac & " stop")
    Do While oExec.Status = 0
        WshShell.Run oCjsleep & " 1", 0, True
    Loop
    If oExec.ExitCode <> 0 Then
        Resource.LogInformation "### Administration Agent stopping failed. ### rtn=" & oResult
        Resource.LogInformation oExec.StdErr.ReadAll
        Offline = False
        Exit Function
    End If
    Offline = True
End Function
 
'==== Close ====
Function Close( )
    Resource.LogInformation "======== Entering Close. ========"
    Close = True
End Function
 
'==== Terminate ====
Function Terminate( )
    Resource.LogInformation "======== Entering Terminate. ========"
    Terminate = True
End Function

実行系の汎用スクリプトファイルでは,必要に応じて変数の値を変更してください。汎用スクリプトファイルで定義する変数については,「(a) 汎用スクリプトファイルの変数」を参照してください。

また,N:1リカバリシステムの汎用スクリプトファイルでは,一つのスクリプトファイルを複数の仮想サーバから参照します。このため,汎用スクリプトファイルがサーバごとの設定を参照できるように,プライベートプロパティを使用します。仮想サーバごとに設定するプライベートプロパティについては,「(3) プライベートプロパティの設定」を参照してください。

(a) 汎用スクリプトファイルの変数

実行系の汎用スクリプトファイルでは,必要に応じて変数の値を変更してください。次の表に示す変数の値を変更してください。

表19‒2 実行系の汎用スクリプトファイルの変数(N:1リカバリシステムの場合)

変数名

内容

oMngHost

Management Serverが稼働しているホスト

oUser

Management ServerにログインするためのログインID

oPass

Management Serverにログインするためのパスワード

(3) プライベートプロパティの設定

仮想サーバごとにプライベートプロパティを設定してください。汎用スクリプトファイルに必要なプライベートプロパティを次の表に示します。

表19‒3 汎用スクリプトファイルに必要なプライベートプロパティ

プライベートプロパティ

内容(例)

ServerName

J2EEサーバ名

指定例:MyServer

StatusPath

インプロセスOTSのステータスパス

指定例:I:\otsstatus

IPAddress

仮想サーバのIPアドレス

指定例:172.16.12.31

HostName

仮想サーバ名

指定例:Server1

プライベートプロパティはclusterコマンドで設定します。clusterコマンドについては,使用しているOSのマニュアルを参照してください。次にclusterコマンドを使用したプライベートプロパティの設定例を示します。

cluster res Script1 /priv ServerName=MyServer
cluster res Script1 /priv StatusPath="I:\otsstatus"
cluster res Script1 /priv IPAddress=172.16.12.31
cluster res Script1 /priv HostName=Server1
 
cluster res Script2 /priv ServerName=MyServer
cluster res Script2 /priv StatusPath="J:\otsstatus"
cluster res Script2 /priv IPAddress=172.16.12.32
cluster res Script2 /priv HostName=Server2
 
cluster res Script3 /priv ServerName=MyServer
cluster res Script3 /priv StatusPath="K:\otsstatus"
cluster res Script3 /priv IPAddress=172.16.12.33
cluster res Script3 /priv HostName=Server3
 
cluster res Script4 /priv ServerName=MyServer2
cluster res Script4 /priv StatusPath="L:\otsstatus"
cluster res Script4 /priv IPAddress=172.16.12.34
cluster res Script4 /priv HostName=Server4

(4) クラスタソフトウェアの環境設定

Windows Server Failover Clusterの環境設定については,使用するクラスタソフトウェアのマニュアルを参照してください。