19.4.4 Setting a cluster
You execute the following settings for a cluster:
-
Create a script file
-
Environment settings of the cluster software
- Organization of this subsection
(1) Create a script file
Code a script file for starting and stopping Application Server in the executing node using VBScript. Use the same script file in each node of the executing node, and allocate the script file to the same path.
The script file uses the general-purpose script as it is. For an example of the general-purpose script file, see (2) Example of a general-purpose script file for the executing node.
This subsection describes the monitoring targets and the monitoring methods for N-to-1 recovery systems.
(a) Monitoring targets
The monitoring target for 1-to-1 node switching systems of Application Server is as follows:
-
Administration Agent
The node switching is executed when Administration Agent ends.
(b) Monitoring method
You monitor the availability of processes of Administration Agent. You monitor the following process:
-
adminagent.exe
(2) Example of a general-purpose script file for the executing node
The following example describes a general-purpose script file used in the executing node of an N-to-1 recovery system:
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.IPAddress & " -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.IPAddress & " -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.IPAddress & " -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 FunctionWith the general-purpose script file of the executing node, you change variable values as and when required. For details on the variables defined in the general-purpose script file, see (a) Variables of the general-purpose script file.
Also, with the general-purpose script file of the N-to-1 recovery system, one script file is referenced from multiple virtual servers. Because of this, use a private property so that the general-purpose script file can reference the settings of each server. For details on the private property specified for each virtual server, see (3) Settings of private property.
(a) Variables of the general-purpose script file
With the general-purpose script file of the executing node, change variable values as and when required. Change the values of the variables described in the following table.
|
Variable name |
Contents |
|---|---|
|
oMngHost |
Host being operated by Management Server |
|
oUser |
Login ID for logging to Management Server |
|
oPass |
Password for logging to Management Server |
(3) Settings of private property
Set up a private property for each virtual server. The following table describes the private properties required for the general-purpose script file.
|
Private property |
Contents (Example) |
|---|---|
|
ServerName |
J2EE server name Specification example: MyServer |
|
StatusPath |
Status path of the in-process OTS Specification example: I:\otsstatus |
|
IPAddress |
IP address of the virtual server Specification example: 172.16.12.31 |
|
HostName |
Virtual server name Specification example: Server1 |
The private properties are set up in the cluster command. For details on the cluster command, see the documentation of the OS that is being used. The following example describes the settings of a private property that uses the cluster command:
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) Environment settings of the cluster software
For the environment settings of Windows Server Failover Cluster, see the documentation of the cluster software that is being used.