Friday, February 3, 2017

Symantec Cluster Server VCS Moving Resource from One Service Group to Another





Unfortunately our Veritas Clusters are rather new, and when setting them up we didn't have a clear plan as to how things where to be laid out. This means that we have far to many Resource Groups making the linking of the resources difficult. Some details discovered did cover some of the things, but not everything, such as the clean up and removal of those redundant RGs. So I decided to include that extra information here, for my reference later. First a note; if you have access to the GUI. This job is 100% easier, as it's just a move and copy affair, in this case we don't have this access due to resources, change requirements and firewall permissions.
Using the tools that VCS gives you, you need to take snap shot of the completed cluster:
# cd /etc/VRTSvcs/conf/config; hacf -verify .
This will create a main.cmd file in the local directory, from this collect the info we need about the RG, so list them:
# hagrp -state
#Group         Attribute             System     Value
cfs_backup     State                 server1    |ONLINE|
cfs_other      State                 server1    |ONLINE|
cvm            State                 server1    |ONLINE|
sg-ip          State                 server1    |OFFLINE|
sg-weblogic    State                 server1    |OFFLINE|
vxfen          State                 server1    |ONLINE|
> hagrp -resources cfs_backup
backup
In the example above we need to move cfs_backup and sg-ip into the sg_weblogic group, and we can see the resource 'backup' belongs to the group 'cfs_backup'. The next command shows us the out put we are going to be using:
# grep "^hares.* backup*" main.cmd
hares -add backup CFSMount cfs_backup
hares -modify backup Critical 0
hares -modify backup MountPoint "/backup"
hares -modify backup BlockDevice "/dev/vx/dsk/backupvg/backupvol"
hares -local backup MountOpt
hares -modify backup MountOpt "cluster" -sys server1
hares -modify backup NodeList  server1
hares -modify backup CloneSkip no
hares -modify backup Policy -delete -keys
hares -modify backup Enabled 1
hares -modify backup_vol CVMDiskGroup backupvg
hares -modify vxfsckd ActivationMode  backupvg sw othervg sw -sys server1
hares -link backup backup_vol
# grep "^hares.* backup*" main.cmd > backup.cmd
Now that we have the captured info, we need to create a delete script
# awk '/^hares -add backup/ {print "hares -delete "$3}' backup.cmd > backup_del.cmd
Once created, edit the backup.cmd and we replace the RED cfs_backup with the new group name 'sg-weblogic'.
# cat backup_del.cmd
hares -delete backup
Update the permissions of the new scripts:
# chmod a+x backup*.cmd
Make the Cluster ready for the edit:
# haconf -makerw
Then run the scripts:
# ./backup_del.cmd
# ./backup.cmd
In our case, we also did the same for the IP group, using the same method above. Once complete you will need to set the cluster back to read-only:
# haconf -dump -makero
Then we stop and start the cluster to make sure it looks all okay?
# hagrp -state
#Group         Attribute             System     Value
cfs_backup     State                 server1    |OFFLINE|
cfs_other      State                 server1    |ONLINE|
cvm            State                 server1    |ONLINE|
sg-ip          State                 server1    |OFFLINE|
sg-weblogic    State                 server1    |ONLINE|
vxfen          State                 server1    |ONLINE|
Once it looks okay, we need to clean up any left parts of these now old defunct RGs, so list there information and dependencies:
# hagrp -resources cfs_backup
<empty>
# hagrp -dep cfs_backup
#Parent      Child      Relationship
cfs_backup   cvm        online local firm
# hagrp -unlink cfs_backup cvm
Finally delete the old RG
# hagrp -delete cfs_backup

Remember to repeat this for any other RGs we cleaned up, in this case the sg-ip group

No comments:

Post a Comment