[Linux-HA] Understanding rule
Andrew Beekhof
beekhof at gmail.com
Tue Jul 10 09:56:07 MDT 2007
On 7/9/07, Adrian Chapela <achapela.rexistros at gmail.com> wrote:
> Andrew Beekhof escribió:
> > On 7/9/07, Adrian Chapela <achapela.rexistros at gmail.com> wrote:
> >>
> >> Andrew Beekhof escribió:
> >> > On 7/6/07, Adrian Chapela <achapela.rexistros at gmail.com> wrote:
> >> >>
> >> >> This rule is quite simple but I can't understand well.
> >> >>
> >> >> <rule id="my_resource:connected:rule" score="-INFINITY"
> >> >> boolean_op="or">
> >> >> <expression id="my_resource:connected:expr:undefined"
> >> >> attribute="pingd" operation="not_defined"/>
> >> >> <expression id="my_resource:connected:expr:zero"
> >> >> attribute="pingd" operation="lte" value="0"/>
> >> >> </rule>
> >> >>
> >> >> The first expression check if the attribute pingd is defined (I
> >> >> think...) and the second expression compares the same attribute
> >> with 0.
> >> >> My problem is, What it's this attribute ?? Who update its value (I
> >> >> think pingd, but the executable or the OCF script)??
> >> >
> >> >
> >> > the OCF script is just a wrapper for the executable
> >> >
> >> > have you read all of http://www.linux-ha.org/v2/faq/pingd ?
> >>
> >> Yes, but I don't understand how can pingd update CIB to change the Score
> >> with this rule ??
> >
> >
> >
> > it doesn't change the rule, it changes a node attribute named "pingd"
> Yes, It was I want to say...
> >
> > the rule then looks this value up for each node the rule is applied on
> >
> > How must my script do to update a similar rule ??
> >>
> >> I only need a clone and the with a rule change a score to move the
> >> IPAddr resource, can you explain me a bit ??
> >
> >
> > that depends, when would the IPaddr need to move?
> Now, I have a OCF script that starts, stops, etc. the resource. This
> script evaluate output of the start, status, stop operation and then use
> the attrd_updater to change value of an attribute. The rule looks this
> attribute and the change the score to move the resource group.
>
> I want to move IPaddr because I have two mysql servers. One is the
> master and the other is the slave. Pingd and MySQL must be started in
Are you using a master_slave resource for MySQL?
> two nodes at the same time and only the VIP can be in one node (master
> node). When master is down, it has a network failure or a resource
> failure the VIP must be assigned to the slave. It will be a new master
> at this time. At this moment I must execute a script to block the
> connections on the mysql port, look for replication state, etc. but
> this is another history!
Since 2.1.0^ you can do this with simple colocation rules.
You do this by having two colocation rules:
one with from=VIP to=MySQL to_role=master score=10000, and
one with from=VIP to=MySQL to_role=slave score=100
I made the scores up, but hopefully you get the point
^ Packages from: http://software.opensuse.org/download/server:/ha-clustering
More information about the Linux-HA
mailing list