[ClusterLabs] Creating a rule based on whether a quorum exists

Ken Gaillot kgaillot at redhat.com
Mon Jun 6 16:36:28 EDT 2016

On 05/30/2016 08:13 AM, Les Green wrote:
> Hi All,
> I have a two-node cluster with no-quorum-policy=ignore and an external
> ping responder to try to determine if a node has its network down (it's
> the dead one), or if the other node is really dead..
> The ping helps to determine who the master is.
> I have realised in the situation where the ping responder goes down,
> both stop being the master.
> Code can be seen here: https://github.com/greemo/vagrant-fabric
> I currently have the following rule which prevents a node becoming a
> master unless it can access the ping resource. (I may add more ping
> resources later):
>     <constraints>
>       <rsc_colocation id="c_mysql_on_drbd" score="INFINITY"
> rsc="g_mysql" with-rsc="ms_drbd_mysql" with-rsc-role="Master"/>
>       <rsc_location id="l_drbd_master_on_ping" rsc="ms_drbd_mysql">
>         <rule role="Master" score="-INFINITY" boolean-op="or"
> id="l_drbd_master_on_ping-rule">
>           <expression attribute="ping" operation="not_defined"
> id="l_drbd_master_on_ping-rule-expression"/>
>           <expression attribute="ping" operation="lte" value="1000"
> type="number" id="l_drbd_master_on_ping-rule-expression-0"/>
>         </rule>
>       </rsc_location>
>       <rsc_order id="o_drbd_before_mysql" score="INFINITY"
> first="ms_drbd_mysql" first-action="promote" then="g_mysql"
> then-action="start"/>
>     </constraints>
> I want to create a rule that says "if I am not in a quorum AND I cannot
> access all the ping resources, do not become the master". I can sort out
> the ping part, but how can I determine within a Pacemaker rule if I am
> part of a quorum?
> I have thought to set up a cron job using shell tools to query the CIB
> and populate an attribute, but surely there has to be an easier way...
> Hopefully, Les

Not that I'm aware of. Some alternatives: set up the ping responder as a
quorum-only node instead; configure fencing and get rid of the ping
resource; list the cluster nodes in the ping resource's host_list and
change the rule to lte 1.

More information about the Users mailing list