Product SiteDocumentation Site

9.4.2. Moving Resources Due to Connectivity Changes

You can configure the cluster to move resources when external connectivity is lost in two steps.

9.4.2.1. Tell Pacemaker to Monitor Connectivity

First, add an ocf:pacemaker:ping resource to the cluster. The ping resource uses the system utility of the same name to a test whether list of machines (specified by DNS hostname or IPv4/IPv6 address) are reachable and uses the results to maintain a node attribute called pingd by default. [17]

Note

Older versions of Heartbeat required users to add ping nodes to ha.cf, but this is no longer required.
Older versions of Pacemaker used a different agent ocf:pacemaker:pingd which is now deprecated in favor of ping. If your version of Pacemaker does not contain the ping resource agent, download the latest version from https://github.com/ClusterLabs/pacemaker/tree/master/extra/resources/ping
Normally, the ping resource should run on all cluster nodes, which means that you’ll need to create a clone. A template for this can be found below along with a description of the most interesting parameters.

Table 9.3. Common Options for a ping Resource

Field Description
dampen
The time to wait (dampening) for further changes to occur. Use this to prevent a resource from bouncing around the cluster when cluster nodes notice the loss of connectivity at slightly different times.
multiplier
The number of connected ping nodes gets multiplied by this value to get a score. Useful when there are multiple ping nodes configured.
host_list
The machines to contact in order to determine the current connectivity status. Allowed values include resolvable DNS host names, IPv4 and IPv6 addresses.

Example 9.2. An example ping cluster resource that checks node connectivity once every minute

<clone id="Connected">
   <primitive id="ping" provider="pacemaker" class="ocf" type="ping">
    <instance_attributes id="ping-attrs">
      <nvpair id="pingd-dampen" name="dampen" value="5s"/>
      <nvpair id="pingd-multiplier" name="multiplier" value="1000"/>
      <nvpair id="pingd-hosts" name="host_list" value="my.gateway.com www.bigcorp.com"/>
    </instance_attributes>
    <operations>
      <op id="ping-monitor-60s" interval="60s" name="monitor"/>
    </operations>
   </primitive>
</clone>

Important

You’re only half done. The next section deals with telling Pacemaker how to deal with the connectivity status that ocf:pacemaker:ping is recording.


[17] The attribute name is customizable, in order to allow multiple ping groups to be defined.