VCS 6.1 : How to Administrate VCS Service Groups using the hagrp

vcs-how-toA service group is an instance of a computer service that is made highly available with VCS. A group comprises one or more resources of various resource types, such as disks, volumes, or databases. Use the hagrp command to view information about and manage each group

 

 

Querying service groups using hagrp

::: To display the state of a service group on a system

# hagrp -state [service_group] [-sys system]

::: To display the resources for a service group

# hagrp -resources service_group

 ::: To display a list of a service group’s dependencies

# hagrp -dep [service_group]

::: To display a service group on a system

# hagrp -display [service_group] [-sys system]
If service_group is not specified, information regarding all service groups is displayed.

::: To display the attributes of a system ( Note that system names are case-sensitive.)

# hagrp -display [service_group] [-attribute attribute] [-sys system]

::: To display the value of a service group attribute

# hagrp -value service_group attribute

 ::: To forecast the target system for failover

Use the following command to view the target system to which a service group fails over during a fault:
# hagrp -forecast service_group [-policy failoverpolicy value] [-verbose]
The policy values can be any one of the following values: Priority, RoundRobin, Load or BiggestAvailable.
Note:
  • You cannot use the -forecast option when the service group state is in transition. For example, VCS rejects the command if the service group is in transition to an online state or to an offline state.
  •  The -forecast option is supported only for failover service groups. In case of offline failover service groups, VCS selects the target system based on the service group’s failover policy.
  •  The BiggestAvailable policy is applicable only when the service group attribute Load is defined and cluster attribute Statistics is enabled.
  •  The actual service group FailOverPolicy can be configured as any policy, but the forecast is done as though FailOverPolicy is set to BiggestAvailable.

Administrating Service Groups

:::  To add a service group to your cluster

 

# hagrp -add service_group
 The variable service_group must be unique among all service groups defined in the cluster.
This command initializes a service group that is ready to contain various resources. To employ the group properly, you must populate its SystemList attribute to define the systems on which the group may be brought online and taken offline. (A system list is an association of names and integers that represent priority values.)

::: To delete a service group

 

# hagrp -delete service_group
Note that you cannot delete a service group until all of its resources are deleted.

::: To modify a service group attribute

# hagrp -modify service_group attribute value [-sys system]
The variable value represents:
system_name1 priority1 system_name2 priority2
 If the attribute that is being modified has local scope, you must specify the system on which to modify the attribute, except when modifying the attribute on the system from which you run the command.
 For example, to populate the system list of service group groupx with Systems A and B, type:
# hagrp -modify groupx SystemList -add SystemA 1 SystemB 2
Similarly, to populate the AutoStartList attribute of a service group, type:
# hagrp -modify groupx AutoStartList SystemA SystemB
You may also define a service group as parallel. To set the Parallel attribute to 1, type the following command. (Note that the default for this attribute is 0, which designates the service group as a failover group.):
# hagrp -modify groupx Parallel 1
  • You cannot modify this attribute if resources have already been added to the service group.
  • You can modify the attributes SystemList, AutoStartList, and Parallel only by using the command hagrp -modify.
  • You cannot modify attributes created by the system, such as the state of the service group.

::: To Modifying the SystemList attribute using

 

You use the hagrp -modify command to change a service group’s existing system list, you can use the options -modify, -add, -update, -delete, or -delete -keys.
 For example, suppose you originally defined the SystemList of service group groupx as SystemA and SystemB. Then after the cluster was brought up you added a new system to the list:
# hagrp -modify groupx SystemList -add SystemC 3
You must take the service group offline on the system that is being modified.
  • When you add a system to a service group’s system list, the system must have been previously added to the cluster. When you use the command line, you can use the hasys -add command.
  •  When you delete a system from a service group’s system list, the service group must not be online on the system to be deleted.
  •  If you attempt to change a service group’s existing system list by using hagrp -modify without other options (such as -add or -update) the command fails.

::: To bring a service group online

 

# hagrp -online service_group -sys system
# hagrp -online service_group -site [site_name]

::: To start a service group on a system and bring online only the resources already online on another system

 

# hagrp -online service_group -sys system -checkpartial other_system
If the service group does not have resources online on the other system, the service group is brought online on the original system and the checkpartial option is ignored.
Note that the checkpartial option is used by the Preonline trigger during failover. When a service group that is configured with Preonline =1 fails over to another system (system 2), the only resources brought online on system 2 are those that were previously online on system 1 prior to failover.

::: To bring a service group and its associated child service groups online

# hagrp -online -propagate service_group -sys system
# hagrp -online -propagate service_group -any
# hagrp -online -propagate service_group -site site

::: To take a service group offline

# hagrp -offline service_group -sys system
# hagrp -offline service_group -site site_name

::: To take a service group offline only if all resources are probed on the system

# hagrp -offline [-ifprobed] service_group -sys system

::: To take a service group and its associated parent service groups offline

# hagrp -offline -propagate service_group -sys system
# hagrp -offline -propagate service_group -any
# hagrp -offline -propagate service_group -site site_name

::: To switch a service group from one system to another

The process of switching a service group involves taking it offline on its current system or site and bringing it online on another system or site.
# hagrp -switch service_group -to system
# hagrp -switch service_group -site site_name
A service group can be switched only if it is fully or partially online. The -switch option is not supported for switching hybrid service groups across system zones.
Switch parallel global groups across clusters by using the following command:
# hagrp -switch service_group -any -clus remote_cluster
VCS brings the parallel service group online on all possible nodes in the remote cluster.

::: To migrate a service group from one system to another

VCS provides live migration capabilities for service groups that have resources to monitor virtual machines. The process of migrating a service group involves concurrently moving the service group from the source system to the target system with minimum downtime.
 # hagrp -migrate service_group -to system
A service group can be migrated only if it is fully online. The -migrate option is supported only for failover service groups and for resource types that have the SupportedOperations attribute set to migrate.
The service group must meet the following requirements regarding configuration:
  •  A single mandatory resource that can be migrated, having the SupportedOperations attribute set to migrate and the Operations attribute set to OnOff
  •  Other optional resources with Operations attribute set to None or OnOnly
The -migrate option is supported for the following configurations:
  • Stand alone service groups
  •  Service groups having one or both of the following configurations:
    •  Parallel child service groups with online local soft or online local firm dependencies
    •  Parallel or failover parent service group with online global soft or online remote soft dependencies

::: To freeze a service group (disable online, offline, and failover operations)

Freeze a service group to prevent it from failing over to another system. This freezing process stops all online and offline procedures on the service group.
Note that if the service group is in ONLINE state and if you freeze the service group, then the group continues to remain in ONLINE state.
# hagrp -freeze service_group [-persistent]
The option -persistent enables the freeze to be remembered when the cluster is rebooted.

::: To unfreeze a service group (reenable online, offline, and failover operations)

Unfreeze a frozen service group to perform online or offline operations on the service group.
# hagrp -unfreeze service_group [-persistent]

 ::: To enable a service group

Enable a service group before you bring it online. A service group that was manually disabled during a maintenance procedure on a system may need to be brought online after the procedure is completed.
# hagrp -enable service_group [-sys system]
A group can be brought online only if it is enabled.

::: To disable a service group

Disable a service group to prevent it from coming online. This process temporarily stops VCS from monitoring a service group on a system that is undergoing maintenance operations
# hagrp -disable service_group [-sys system]
A group cannot be brought online or switched if it is disabled.

::: To enable all resources in a service group

# hagrp -enableresources service_group

::: To disable all resources in a service group

 

# hagrp -disableresources service_group
Agents do not monitor group resources if resources are disabled.

::: To clear faulted, non-persistent resources in a service group

# hagrp -clear service_group [-sys system]
Clearing a resource initiates the online process previously blocked while waiting for the resource to become clear.
  • If system is specified, all faulted, non-persistent resources are cleared from that system only.
  • If system is not specified, the service group is cleared on all systems in the group’s SystemList in which at least one non-persistent resource has faulted.

::: To clear resources in ADMIN_WAIT state in a service group

# hagrp -clearadminwait [-fault] service_group -sys system

::: To flush a service group on a system

When a service group is brought online or taken offline, the resources within the group are brought online or taken offline. If the online operation or offline operation hangs on a particular resource, flush the service group to clear the WAITING TO GO ONLINE or WAITING TO GO OFFLINE states from its resources. Flushing a service group typically leaves the service group in a partial state. After you complete this process, resolve the issue with the particular resource (if necessary) and proceed with starting or stopping the service group.
Note:  The flush operation does not halt the resource operations (such as online, offline, migrate, and clean) that are running. If a running operation succeeds after a flush command was fired, the resource state might change depending on the operation.
  • Use the command hagrp -flush to clear the internal state of VCS.
  • The hagrp -flush command transitions resource state from ‘waiting to go online’ to ‘not waiting’.
  • You must use the hagrp -flush -force command to transition resource state from ‘waiting to go offline’ to ‘not waiting’.
# hagrp -flush [-force] group -sys system [-clus cluster | -localclus]

::: To flush all service groups on a system using a script  . e.g :  /opt/VRTSvcs/bin/haflush script

# haflush systemname
 Sample Content of haflush at the location /opt/VRTSvcs/bin/
    #!/bin/ksh
    PATH=/opt/VRTSvcs/bin:$PATH; export PATH 
    if [ $# -ne 1 ]; then 
        echo “usage: $0 <system name>” 
        exit 1 
    fi 
 
    hagrp -list | 
    while read grp sys junk 
    do 
        locsys=”${sys##*:}” 
        case “$locsys” in 
        “$1”) 
            hagrp -flush “$grp” -sys “$locsys” 
            ;; 
        esac 
    done
 

::: To link service groups

linking service groups used to create a dependency between them.
# hagrp -link parent_group child_group gd_category gd_location [gd_type]
  • parent_group Name of the parent group
  • child_group Name of the child group
  • gd_category Category of group dependency (online/offline).
  • gd_location The scope of dependency (local/global/remote/site).
  • gd_type Type of group dependency (soft/firm/hard). Default is firm.

::: To unlink service groups

 

# hagrp -unlink parent_group child_group
Ramdev

Ramdev

I have started unixadminschool.com ( aka gurkulindia.com) in 2009 as my own personal reference blog, and later sometime i have realized that my leanings might be helpful for other unixadmins if I manage my knowledge-base in more user friendly format. And the result is today's' unixadminschool.com. You can connect me at - https://www.linkedin.com/in/unixadminschool/

What is in your mind, about this post ? Leave a Reply

Close
  Our next learning article is ready, subscribe it in your email

What is your Learning Goal for Next Six Months ? Talk to us