Wise people learn when they can; fools learn when they must - Arthur Wellesley

Sunday, 19 March 2017

VCS ON RHEL6–CONFIGURE & OPERATION-P5 (APACHE VIA CLI)


VCS ON RHEL6–CONFIGURE & OPERATION-P5


ONLINE CONFIGURATION THROUGH CLI:

First open the config,

[root@pr01 /]# haconf -makerw

SERVICE GROUP CONFIGURATION:

[root@pr01 ~]# hagrp -add Web-App
VCS NOTICE V-16-1-10136 Group added; populating SystemList and setting the Parallel attribute recommended before adding resources


“Web-App” is the unique name for service group.

[root@pr01 ~]# hagrp -modify Web-App SystemList pr01 0 dr01 1

“pr01” & “dr01” are the systems on which SG will/can run.
Priority no “0” & “1” are the order of systems selected for failover, lower no system is selected first.

[root@pr01 ~]# hagrp -modify Web-App AutoStartList pr01

If the SG is not online anywhere, the “AutoStartList” will  automatically start it on defined system at the startup of system.

ADDING RESOURCES:

[root@pr01 ~]# hares -add Nic_Res NIC Web-App
VCS NOTICE V-16-1-10242 Resource added. Enabled attribute must be set before agent monitors

Add resource in order of dependency starting at bottom.

[root@pr01 ~]# hares -modify Nic_Res Critical 0

Set each resource to non-critical until testing has completed.

[root@pr01 ~]# hares -modify Nic_Res Device eth0

Configure all required attributes.

[root@pr01 /]# hares -modify Nic_Res Enabled 1

Enable the resource.


[root@pr01 /]# hares -online Nic_Res -sys pr01
VCS WARNING V-16-1-10271 Resources of Operations type 'None' do not support onlining or offlining

Bring each resource online before adding next resource.

PERSISTENT RESOURCE:

These types of resources are “on-only” or “none” and cannot be taken offline.

A persistent resource does not have any role in SG status, because they are always online.

NIC is persistent resource.

IP RESOURCE:

[root@pr01 ~]# hares -add Service_IP IP Web-App
VCS NOTICE V-16-1-10242 Resource added. Enabled attribute must be set before agent monitors
[root@pr01 ~]# hares -modify Service_IP Critical 0
[root@pr01 ~]# hares -modify Service_IP Device eth0
[root@pr01 ~]# hares -modify Service_IP Address 192.168.234.200
[root@pr01 ~]# hares -modify Service_IP NetMask 255.255.255.0


This is Virtual IP address, and must be different from administrative ip. The virtual IP is associated with the next network interface for “eth0”, which is “eth0:0”

Virtual ip addresses are configured by the agent using “ifconfig”

DG RESOURCE:

[root@pr01 ~]# hares -add DG_Res DiskGroup Web-App
VCS NOTICE V-16-1-10242 Resource added. Enabled attribute must be set before agent monitors
[root@pr01 ~]# hares -modify DG_Res Critical 0
[root@pr01 ~]# hares -modify DG_Res DiskGroup apps_dg
[root@pr01 ~]# hares -modify DG_Res Enabled 1

VOLUME RESOURCE:

[root@pr01 ~]# hares -add Volume_Res Volume Web-App
VCS NOTICE V-16-1-10242 Resource added. Enabled attribute must be set before agent monitors
[root@pr01 ~]# hares -modify Volume_Res Critical 0
[root@pr01 ~]# hares -modify Volume_Res Volume apps_vol
[root@pr01 ~]# hares -modify Volume_Res DiskGroup apps_dg
[root@pr01 ~]# hares –modify Volume_Res Enabled 1

The “volume Agent” starts a volume using “vxrecover” and stops a volume using “vxvol”

MOUNT RESOURCE:

[root@pr01 ~]# hares -add Mount_Res Mount Web-App
VCS NOTICE V-16-1-10242 Resource added. Enabled attribute must be set before agent monitors
[root@pr01 ~]# hares -modify Mount_Res Critical 0
[root@pr01 ~]# hares -modify Mount_Res MountPoint /apps
[root@pr01 ~]# hares -modify Mount_Res BlockDevice /dev/vx/dsk/apps_dg/apps_vol
[root@pr01 ~]# hares -modify Mount_Res FSType vxfs
[root@pr01 ~]# hares -modify Mount_Res FsckOpt %-y
[root@pr01 ~]# hares -modify Mount_Res Enabled 1

PROCESS RESOURCE:

[root@pr01 ~]# hares -add Web_Res Apache Web-App
VCS NOTICE V-16-1-10242 Resource added. Enabled attribute must be set before agent monitors
[root@pr01 ~]# hares -modify Web_Res Critical 0
[root@pr01 ~]# hares -modify Web_Res httpdDir /usr/sbin
 [root@pr01 ~]# hares -modify Web_Res ConfigFile /etc/httpd/conf/httpd.conf
[root@pr01 ~]# hares -modify Web_Res HostName web.mylabs.org
[root@pr01 ~]# hagrp -enableresources Web-App

Process resource should be added in last because it need all other resources to be online in order to start the application.

RESOURCE DEPENDENCY TREE:

[root@pr01 ~]# hares -link Web_Res Service_IP
[root@pr01 ~]# hares -link Web_Res Mount_Res
[root@pr01 ~]# hares -link Service_IP Nic_Res
[root@pr01 ~]# hares -link Mount_Res Volume_Res
[root@pr01 ~]# hares -link Volume_Res DG_Res
[root@pr01 ~]# hagrp -online Web-App -sys pr01

CLOSING CONFIG:

[root@pr01 log]# haconf -dump –makero


FLUSHING A SERVICE GROUP:

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.

Note:
The flush operation does not halt the resource operations (such as online, offline, 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.

Flushing a SG stops VCS from attempting to bring resource online and clears any internal wait state.

[root@pr01 ~]# hagrp -flush -force Web-App -sys pr01

DISABLING RESOURCE:

Disabling a resource means that the resource is no longer monitored by a VCS agent, and that the resource cannot be brought online or taken offline. The agent starts monitoring the resource after the resource is enabled. The resource attribute Enabled determines whether a resource is enabled or disabled. A persistent resource can be disabled when all its parents are offline. A non-persistent resource can be disabled when the resource is in an OFFLINE state.

When to disable a resource

Typically, resources are disabled when one or more resources in the service group encounter problems and disabling the resource is required to keep the service group online or to bring it online.

Note   Disabling a resource is not an option when the entire service group requires disabling. In that case, set the service group attribute Enabled to 0.

To disable a resource

To disable the resource when VCS is running:

#hares -modify resource_name Enabled 0

To have the resource disabled initially when VCS is started, set the resource's Enabled attribute to 0 in main.cf.

RESOURCE FAULT:

Agents monitor both online as well as offline resources periodically.

VCS considers a resource faulted in the following situations:

·         When the resource state changes unexpectedly. For example, an online resource going offline.

·         When a required state change does not occur. For example, a resource failing to go online or offline when commanded to do so.

·         When the underlying component is not available.


In many situations, VCS agents take predefined actions to correct the issue before reporting resource failure to the engine. For example, the agent may try to bring a resource online several times before declaring a fault.

When a resource faults, VCS takes automated actions to "clean up the faulted resource. The Clean function makes sure the resource is completely shut down before bringing it online on another node. This prevents concurrency violations.

When a resource faults, VCS takes all resources dependent on the faulted resource offline. The fault is thus propagated in the service group

FIX:

Clear non-persistent resources and bring back online manually.

Probe persistent resources, otherwise resources does not show online until the next “OfflineMonitorInterval” (default is 300 seconds).

Fault means unexpected offline state for a previously online resource. Problem must resolve before clearing fault.

[root@pr01 ~]# hares -display | grep FAULT
NFS_NIC1     State                 pr01       FAULTED
Nic_Res      State                 pr01       FAULTED

[root@pr01 ~]# hares -display | grep FAULT
NFS_MOUNT1   State                 dr01       FAULTED

[root@pr01 ~]# hares -clear NFS_MOUNT1 -sys pr01
VCS WARNING V-16-1-10266 Resource not faulted on node pr01

[root@pr01 ~]# hares -clear NFS_MOUNT1
[root@pr01 ~]# hares -display | grep FAULT
[root@pr01 ~]# hares -online NFS_MOUNT1 -sys pr01
[root@pr01 config]# hares -display | grep NFS_MOUNT1 | grep ONLINE
NFS_MOUNT1   State                 pr01       ONLINE

If system name is not provided then the resource will clear on all systems.

[root@pr01 ~]# hares -clear NFS_NIC1 -sys pr01
VCS WARNING V-16-1-10263 Cannot clear resource of Operations type 'None'
[root@pr01 ~]# hares -probe NFS_NIC1 -sys pr01
[root@pr01 ~]# hares -clear Nic_Res -sys pr01
VCS WARNING V-16-1-10263 Cannot clear resource of Operations type 'None'
[root@pr01 ~]# hares -probe Nic_Res -sys pr01


VERIFY CONFIGURATION:

[root@pr01 config]# hacf -verify /etc/VRTSvcs/conf/config

If nothing in O/P means there is no Syntax Error.

SERVICE GROUP STATES:

OFFLINE  - All non-persistent resources are offline.
ONLINE  -  All resources whose AutoStart attribute is equal to 1 are online.
FAULTED -  At least one critical resource in the group is faulted or is affected
      by a fault.
PARTIAL -  At least one, but not all, resources whose AutoStart attribute is
           equal to 1 are online in the group.
STARTING - Group is attempting to go online.
STOPPING - Group is attempting to go offline.


GOOD READ: 



No comments:

Post a Comment