Veritas Cluster Tasks

Create a Service Group

hagrp -add groupw
hagrp -modify groupw SystemList sun1 1 sun2 2
hagrp -autoenable groupw -sys sun1

Create a disk group resource , volume and filesystem resource

We have to create a disk group resource, this will ensure that the disk group has been imported before we start any volumes
hares -add appDG DiskGroup groupw
hares -modify appDG Enabled 1
hares -modify appDG DiskGroup appdg
hares -modify appDG StartVolumes 0

Once the disk group resource has been created we can create the volume resource
hares -add appVOL Volume groupw
hares -modify appVOL Enabled 1
hares -modify appVOL Volume app01
hares -modify appVOL DiskGroup appdg

Now that the volume resource has been created we can create the filesystem mount resource
hares -add appMOUNT Mount groupw
hares -modify appMOUNT Enabled 1
hares -modify appMOUNT MountPoint /apps
hares -modify appMOUNT BlockDevice /dev/vx/dsk/appdg/app01
hares -modify appMOUNT FSType vxfs

To ensure that all resources are started in order, we create dependencies against each other
hares -link appVOL appDG
hares -link appMOUNT appVOL

Create a application resource

Once the filesystem resource has been created we cab add a application resource, this will start, stop and monitor the application.
hares -add sambaAPP Application groupw
hares -modify sambaAPP Enabled 1
hares -modify sambaAPP User root
hares -modify sambaAPP StartProgram "/etc/init.d/samba start"
hares -modify sambaAPP StopProgram "/etc/init.d/samba stop"
hares -modify sambaAPP CleanProgram "/etc/init.d/samba clean"
hares -modify sambaAPP PidFiles "/usr/local/samba/var/locks/smbd.pid" "/usr/local/samba/var/locks/nmbd.pid"
hares -modify sambaAPP MonitorProcesses "smbd -D" "nmdb -D"

Create a single virtual IP resource

create a single NIC resource
hares -add appNIC NIC groupw
hares -modify appNIC Enabled 1
hares -modify appNIC Device qfe0

Create the single application IP resource
hares -add appIP IP groupw
hres -modify appIP Enabled 1
hres -modify appIP Device qfe0
hres -modify appIP Address 192.168.0.3
hres -modify appIP NetMask 255.255.255.0
hres -modify appIP IfconfigTwice 1

Create a multi virtual IP resource

Create a multi NIC resource
hares -add appMultiNICA MultiNICA groupw
hares -local appMultiNICA Device
hares -modify appMulitNICA Enabled 1
hares -modify appMulitNICA Device qfe0 192.168.0.3 qfe1 192.168.0.3 -sys sun1 sun2
hares -modify appIPMultiNIC NetMask 255.255.255.0
hares -modify appIPMultiNIC ArpDelay 5
hares -modify appIPMultiNIC IfconfigTwice 1

Create the multi Ip address resource, this will monitor the virtual IP addresses.
hares -add appIPMultiNIC IPMultiNIC groupw
hares -modify appIPMultiNIC Enabled 1
hares -modify appIPMultiNIC Address 192.168.0.3
hares -modify appIPMultiNIC NetMask 255.255.255.0
hares -modify appIPMultiNIC MultiNICResName appMultiNICA
hares -modify appIPMultiNIC IfconfigTwice 1

Clear resource fault

# hastatus -sum

-- SYSTEM STATE
-- System     State              Frozen

A sun1         RUNNING    0
A sun2         RUNNING    0

-- GROUP STATE
-- Group       System   Probed   AutoDisabled    State

B  groupw   sun1        Y             N                          OFFLINE
B  groupw   sun2        Y             N                          STARTING|PARTIAL

-- RESOURCES ONLINING
-- Group     Type      Resource              System     IState

E groupw   Mount    app02MOUNT   sun2          W_ONLINE

# hares -clear app02MOUNT

Flush a group

# hastatus -sum

-- SYSTEM STATE
-- System     State              Frozen

A sun1         RUNNING    0
A sun2         RUNNING    0

-- GROUP STATE
-- Group       System   Probed   AutoDisabled    State

B  groupw   sun1        Y             N                          STOPPING|PARTIAL
B  groupw   sun2        Y             N                          OFFLINE|FAULTED

-- RESOURCES FAILED
-- Group      Type       Resource               System

C groupw    Mount    app02MOUNT     sun2

-- RESOURCES ONLINING
-- Group       Type       Resource               System      IState

E groupw     Mount    app02MOUNT     sun1           W_ONLINE_REVERSE_PROPAGATE

-- RESOURCES OFFLINING
-- Group        Type             Resource     System      IState

F groupw      DiskGroup   appDG          sun1          W_OFFLINE_PROPAGATE

# hagrp -flush groupw -sys sun1