[ClusterLabs] Problems with master/slave failovers
Ken Gaillot
kgaillot at redhat.com
Fri Jun 28 11:10:05 EDT 2019
On Fri, 2019-06-28 at 07:36 +0000, Harvey Shepherd wrote:
> Thanks for your reply Andrei. Whilst I understand what you say about
> the difficulties of diagnosing issues without all of the info, it's a
> compromise between a mailing list posting being very verbose in which
> case nobody wants to read it, and containing enough relevant
> information for someone to be able to help. With 20+ resources
> involved during a failover there are literally thousands of logs
> generated, and it would be pointless to post them all.
>
> I've tried to focus in on the king resource only to keep things
> simple, as that is the only resource that can initiate a failover. I
> provided the real master scores and transition decisions made by
> pacemaker at the times that I killed the king master resource by
> showing the crm_simulator output from both tests, and the CIB config
> is ss described. As I mentioned, migration-threshold is set to zero
> for all resources, so it shouldn't prevent a second failover.
>
> Regarding the resource agent return codes, the failure is detected by
> the 10s king resource master instance monitor operation, which
> returns OCF_ERR_GENERIC because the resource is expected to be
> running and isn't (the OCF resource agent developers guide states
> that monitor should only return OCF_NOT_RUNNING if there is no error
> condition that caused the resource to stop).
>
> What would be really helpful would be if you or someone else could
> help me decipher the crm_simulate output:
I've been working with Pacemaker for years and still look at those
scores only after exhausting all other investigation.
It isn't AI, but the complexity is somewhat similar in that it's not
really possible to boil down the factors that went into a decision in a
few human-readable sentences. We do have a project planned to provide
some insight in human-readable form.
But if you really want the headache:
> 1. What is the difference between clone_color and native_color?
native_color is scores added by the resource as a primitive resource,
i.e. the resource being cloned. clone_color is scores added by the
resource as a clone, i.e. the internal abstraction that allows a
primitive resource to run in multiple places. All it really means is
that different C functions added the scores, which is pretty useless
without staring at the source code of those functions.
> 2. What is the difference between "promotion scores" and "allocation
> scores" and why does the output show several instances of each?
Allocation is placement of particular resources (including individual
clone instances) to particular nodes; promotion is selecting an
instance to be master.
The multiple occurrences are due to multiple factors going into the
final score.
> 3. How does pacemaker use those scores to decide whether to failover?
It doesn't -- it uses them to determine where to failover. Whether to
failover is determined by fail-count and resource operation history
(and affected by configured policies such as on-fail, failure-timeout,
and migration-threshold).
> 4. Why is there a -INFINITY score on one node?
That sometimes requires trace-level debugging and following the path
through the source code. Which I don't recommend unless you're wanting
to make this a full-time gig :)
At this level of investigation, I usually start with giving
crm_simulate -VVVV, which will show up to info-level logs. If that
doesn't make it clear, add another -V for debug logs, and then another
-V for trace logs, but that stretches the bounds of human
intelligibility. Somewhat more helpful is PCMK_trace_tags=<resource-
name> before crm_simulate, which will give some trace-level output for
the given resource without swamping you with infinite detail. For
clones it's best to use PCMK_trace_tags=<resource-name>,<clone-name>
and sometimes even <resource-name>:0, etc.
> Thanks again for your help.
>
>
>
> On 28 Jun 2019 6:46 pm, Andrei Borzenkov <arvidjaar at gmail.com> wrote:
> > On Fri, Jun 28, 2019 at 7:24 AM Harvey Shepherd
> > <Harvey.Shepherd at aviatnet.com> wrote:
> > >
> > > Hi All,
> > >
> > >
> > > I'm running Pacemaker 2.0.2 on a two node cluster. It runs one
> > master/slave resource (I'll refer to it as the king resource) and
> > about 20 other resources which are a mixture of:
> > >
> > >
> > > - resources that only run on the king resource master node
> > (colocation constraint with a score of INFINITY)
> > >
> > > - clone resources that run on both nodes
> > >
> > > - two other master/slave resources where the masters runs on the
> > same node as the king resource master (colocation constraint with a
> > score of INFINITY)
> > >
> > >
> > > I'll refer to the above set of resources as servant resources.
> > >
> > >
> > > All servant resources have a resource-stickiness of zero and the
> > king resource has a resource-stickiness of 100. There is an
> > ordering constraint that the king resource must start before all
> > servant resources. The king resource is controlled by an OCF script
> > that uses crm_master to set the preferred master for the king
> > resource (current master has value 100, current slave is 5,
> > unassigned role or resource failure is 1) - I've verified that
> > these values are being set as expected upon
> > promotion/demotion/failure etc, via the logs. That's pretty much
> > all of the configuration - there is no configuration around node
> > preferences and migration-threshold is zero for everything.
> > >
> > >
> > > What I'm trying to achieve is fairly simple:
> > >
> > >
> > > 1. If any servant resource fails on either node, it is simply
> > restarted. These resources should never failover onto the other
> > node because of colocation with the king resource, and they should
> > not contribute in any way to deciding whether the king resource
> > should failover (which is why they have a resource-stickiness of
> > zero).
> > >
> > > 2. If the slave instance of the king resource fails, it should
> > simply be restarted and again no failover should occur.
> > >
> > > 3. If the master instance of the king resource fails, then its
> > slave instance should immediately be promoted, and the failed
> > instance should be restarted. Failover of all servant resources
> > should then occur due to the colocation dependency.
> > >
> > >
> > > It's number 3 above that I'm having trouble with. If I kill the
> > master king resource instance it behaves as I expect - everything
> > fails over and the king resource is restarted on the new slave. If
> > I then kill the master instance of the king resource again however,
> > instead of failing back over to its original node, it restarts and
> > promotes back to master on the same node. This is not what I want.
> > >
> >
> > migration-threshold is the first thing that comes in mind. Another
> > possibility is hard error returned by resource agent that forces
> > resource off node.
> >
> > But please realize that without actual configuration and logs at
> > the
> > time undesired behavior happens it just becomes game of riddles.
> >
> > >
> > > The relevant output from crm_simulate for the two tests is shown
> > below. Can anyone suggest what might be going wrong? Whilst I
> > really like the concept of crm_simulate, I can't find a good
> > description of how to interpret the output and I don't understand
> > the difference between clone_color and native_color, or the
> > difference between "promotion scores" and the various instances of
> > "allocation scores", nor does it really tell me what is
> > contributing to the scores. Where does the -INFINITY allocation
> > score come from for example?
> > >
> > >
> > > Thanks,
> > >
> > > Harvey
> > >
> > >
> > >
> > > FIRST KING RESOURCE MASTER FAILURE (CORRECT BEHAVIOUR - MASTER
> > NODE FAILOVER OCCURS)
> > >
> > >
> > > Clone Set: ms_king_resource [king_resource] (promotable)
> > > king_resource (ocf::aviat:king-resource-ocf): FAILED
> > Master secondary
> > > clone_color: ms_king_resource allocation score on primary: 0
> > > clone_color: ms_king_resource allocation score on secondary: 0
> > > clone_color: king_resource:0 allocation score on primary: 0
> > > clone_color: king_resource:0 allocation score on secondary: 101
> > > clone_color: king_resource:1 allocation score on primary: 200
> > > clone_color: king_resource:1 allocation score on secondary: 0
> > > native_color: king_resource:1 allocation score on primary: 200
> > > native_color: king_resource:1 allocation score on secondary: 0
> > > native_color: king_resource:0 allocation score on primary:
> > -INFINITY
> > > native_color: king_resource:0 allocation score on secondary: 101
> > > king_resource:1 promotion score on primary: 100
> > > king_resource:0 promotion score on secondary: 1
> > > * Recover king_resource:0 ( Master -> Slave secondary )
> > > * Promote king_resource:1 ( Slave -> Master primary )
> > > * Resource action: king_resource cancel=10000 on secondary
> > > * Resource action: king_resource cancel=11000 on primary
> > > * Pseudo action: ms_king_resource_pre_notify_demote_0
> > > * Resource action: king_resource notify on secondary
> > > * Resource action: king_resource notify on primary
> > > * Pseudo action: ms_king_resource_confirmed-
> > pre_notify_demote_0
> > > * Pseudo action: ms_king_resource_demote_0
> > > * Resource action: king_resource demote on secondary
> > > * Pseudo action: ms_king_resource_demoted_0
> > > * Pseudo action: ms_king_resource_post_notify_demoted_0
> > > * Resource action: king_resource notify on secondary
> > > * Resource action: king_resource notify on primary
> > > * Pseudo action: ms_king_resource_confirmed-
> > post_notify_demoted_0
> > > * Pseudo action: ms_king_resource_pre_notify_stop_0
> > > * Resource action: king_resource notify on secondary
> > > * Resource action: king_resource notify on primary
> > > * Pseudo action: ms_king_resource_confirmed-pre_notify_stop_0
> > > * Pseudo action: ms_king_resource_stop_0
> > > * Resource action: king_resource stop on secondary
> > > * Pseudo action: ms_king_resource_stopped_0
> > > * Pseudo action: ms_king_resource_post_notify_stopped_0
> > > * Resource action: king_resource notify on primary
> > > * Pseudo action: ms_king_resource_confirmed-
> > post_notify_stopped_0
> > > * Pseudo action: ms_king_resource_pre_notify_start_0
> > > * Resource action: king_resource notify on primary
> > > * Pseudo action: ms_king_resource_confirmed-pre_notify_start_0
> > > * Pseudo action: ms_king_resource_start_0
> > > * Resource action: king_resource start on secondary
> > > * Pseudo action: ms_king_resource_running_0
> > > * Pseudo action: ms_king_resource_post_notify_running_0
> > > * Resource action: king_resource notify on secondary
> > > * Resource action: king_resource notify on primary
> > > * Pseudo action: ms_king_resource_confirmed-
> > post_notify_running_0
> > > * Pseudo action: ms_king_resource_pre_notify_promote_0
> > > * Resource action: king_resource notify on secondary
> > > * Resource action: king_resource notify on primary
> > > * Pseudo action: ms_king_resource_confirmed-
> > pre_notify_promote_0
> > > * Pseudo action: ms_king_resource_promote_0
> > > * Resource action: king_resource promote on primary
> > > * Pseudo action: ms_king_resource_promoted_0
> > > * Pseudo action: ms_king_resource_post_notify_promoted_0
> > > * Resource action: king_resource notify on secondary
> > > * Resource action: king_resource notify on primary
> > > * Pseudo action: ms_king_resource_confirmed-
> > post_notify_promoted_0
> > > * Resource action: king_resource monitor=11000 on secondary
> > > * Resource action: king_resource monitor=10000 on primary
> > > Clone Set: ms_king_resource [king_resource] (promotable)
> > >
> > >
> > > SECOND KING RESOURCE MASTER FAILURE (INCORRECT BEHAVIOUR - SAME
> > NODE IS PROMOTED TO MASTER)
> > >
> > >
> > > Clone Set: ms_king_resource [king_resource] (promotable)
> > > king_resource (ocf::aviat:king-resource-ocf): FAILED
> > Master primary
> > > clone_color: ms_king_resource allocation score on primary: 0
> > > clone_color: ms_king_resource allocation score on secondary: 0
> > > clone_color: king_resource:0 allocation score on primary: 0
> > > clone_color: king_resource:0 allocation score on secondary: 200
> > > clone_color: king_resource:1 allocation score on primary: 101
> > > clone_color: king_resource:1 allocation score on secondary: 0
> > > native_color: king_resource:0 allocation score on primary: 0
> > > native_color: king_resource:0 allocation score on secondary: 200
> > > native_color: king_resource:1 allocation score on primary: 101
> > > native_color: king_resource:1 allocation score on secondary:
> > -INFINITY
> > > king_resource:1 promotion score on primary: 1
> > > king_resource:0 promotion score on secondary: 1
> > > * Recover king_resource:1 ( Master primary )
> > > * Pseudo action: ms_king_resource_pre_notify_demote_0
> > > * Resource action: king_resource notify on secondary
> > > * Resource action: king_resource notify on primary
> > > * Pseudo action: ms_king_resource_confirmed-
> > pre_notify_demote_0
> > > * Pseudo action: ms_king_resource_demote_0
> > > * Resource action: king_resource demote on primary
> > > * Pseudo action: ms_king_resource_demoted_0
> > > * Pseudo action: ms_king_resource_post_notify_demoted_0
> > > * Resource action: king_resource notify on secondary
> > > * Resource action: king_resource notify on primary
> > > * Pseudo action: ms_king_resource_confirmed-
> > post_notify_demoted_0
> > > * Pseudo action: ms_king_resource_pre_notify_stop_0
> > > * Resource action: king_resource notify on secondary
> > > * Resource action: king_resource notify on primary
> > > * Pseudo action: ms_king_resource_confirmed-pre_notify_stop_0
> > > * Pseudo action: ms_king_resource_stop_0
> > > * Resource action: king_resource stop on primary
> > > * Pseudo action: ms_king_resource_stopped_0
> > > * Pseudo action: ms_king_resource_post_notify_stopped_0
> > > * Resource action: king_resource notify on secondary
> > > * Pseudo action: ms_king_resource_confirmed-
> > post_notify_stopped_0
> > > * Pseudo action: ms_king_resource_pre_notify_start_0
> > > * Resource action: king_resource notify on secondary
> > > * Pseudo action: ms_king_resource_confirmed-pre_notify_start_0
> > > * Pseudo action: ms_king_resource_start_0
> > > * Resource action: king_resource start on primary
> > > * Pseudo action: ms_king_resource_running_0
> > > * Pseudo action: ms_king_resource_post_notify_running_0
> > > * Resource action: king_resource notify on secondary
> > > * Resource action: king_resource notify on primary
> > > * Pseudo action: ms_king_resource_confirmed-
> > post_notify_running_0
> > > * Pseudo action: ms_king_resource_pre_notify_promote_0
> > > * Resource action: king_resource notify on secondary
> > > * Resource action: king_resource notify on primary
> > > * Pseudo action: ms_king_resource_confirmed-
> > pre_notify_promote_0
> > > * Pseudo action: ms_king_resource_promote_0
> > > * Resource action: king_resource promote on primary
> > > * Pseudo action: ms_king_resource_promoted_0
> > > * Pseudo action: ms_king_resource_post_notify_promoted_0
> > > * Resource action: king_resource notify on secondary
> > > * Resource action: king_resource notify on primary
> > > * Pseudo action: ms_king_resource_confirmed-
> > post_notify_promoted_0
> > > * Resource action: king_resource monitor=10000 on primary
> > > Clone Set: ms_king_resource [king_resource] (promotable)
--
Ken Gaillot <kgaillot at redhat.com>
More information about the Users
mailing list