[Pacemaker] Colocation advice seeked

Neil Katin linuxha at askneil.com
Thu Mar 19 21:00:30 UTC 2009


Hi there.  I'm looking for advice about the "proper" way to configure
pacemaker to support our access to a mysql cluster.

We're planning on configuring two mysql servers with master-master
replication.  We'd like one of them to be the "master", and the other
to be available as the "slave" (with a pacemaker managed IP address
following those roles).

If only one mysql instance is running we would like that node to
own both the ip addresses.

I thought this would be fairly straightforward to configure, but
there seems to be something about colocation I'm not understanding.

Here's the configuration I'm running:

primitive mysql0 ocf:heartbeat:mysql \
         params datadir="/var/lib/mysql" mysql_config="/etc/my.cnf" binary="/usr/bin/mysqld_safe" test_user="test" test_table="information_schema.schemata" OCF_CHECK_LEVEL="10" \
         op monitor interval="60s" timeout="30s" \
         op start interval="0s" timeout="300s" \
         op stop interval="0s" timeout="300s"
primitive mysql1 ocf:heartbeat:mysql \
         params datadir="/var/lib/mysql" mysql_config="/etc/my.cnf" binary="/usr/bin/mysqld_safe" test_user="test"test_table="information_schema.schemata" OCF_CHECK_LEVEL="10" \
         op monitor interval="60s" timeout="30s" \
         op start interval="0s" timeout="300s" \
         op stop interval="0s" timeout="300s"
primitive ip-master ocf:heartbeat:IPaddr2 \
         params ip="192.168.1.210" nic="eth1" cidr_netmask="24" \
         op monitor interval="60s"
primitive ip-slave ocf:heartbeat:IPaddr2 \
         params ip="192.168.1.211" nic="eth1" cidr_netmask="24" \
         op monitor interval="60s"
location mysql0-location mysql0 \
         rule $id="mysql0-location-rule" -inf: #uname ne gv-neil0.bunchball.net
location mysql1-location mysql1 \
         rule $id="mysql1-location-rule" -inf: #uname ne gv-neil2.bunchball.net
location ip-master-location ip-master \
         rule $id="ip-master-location-rule" -inf: #uname ne gv-neil0.bunchball.net and #uname ne gv-neil2.bunchball.net
location ip-slave-location ip-slave \
         rule $id="ip-slave-location-rule" -inf: #uname ne gv-neil0.bunchball.net and #uname ne gv-neil2.bunchball.net
colocation ip-master-colo-slave -1: ip-slave ip-master
colocation ip-master-colo-mysql0 10: ip-master mysql0
property $id="cib-bootstrap-options" \
         dc-version="1.0.2-c02b459053bfa44d509a2a0e0247b291d93662b7" \
         last-lrm-refresh="1237492227"

I have the database nodes "pinned" to a particular machine, and the
ip addresses can run on either of those database machines.

It works fine when all nodes are up.

When I put one of the database machines in standby however, the ip address
doesn't move.  Here's the output of ptest -LVVs:

Allocation scores:
ptest[3795]: 2009/03/19_16:48:25 WARN: unpack_resources: No STONITH resources have been defined
native_color: mysql0 allocation score on gv-neil2.bunchball.net: -1000000
native_color: mysql0 allocation score on gv-neil0.bunchball.net: 0
native_color: mysql0 allocation score on gv-neil3.bunchball.net: -1000000
ptest[3795]: 2009/03/19_16:48:25 WARN: native_color: Resource mysql0 cannot run anywhere
native_color: mysql1 allocation score on gv-neil2.bunchball.net: 0
native_color: mysql1 allocation score on gv-neil0.bunchball.net: -1000000
native_color: mysql1 allocation score on gv-neil3.bunchball.net: -1000000
native_color: ip-master allocation score on gv-neil2.bunchball.net: -10
native_color: ip-master allocation score on gv-neil0.bunchball.net: -10
native_color: ip-master allocation score on gv-neil3.bunchball.net: -1000000
ptest[3795]: 2009/03/19_16:48:25 WARN: native_color: Resource ip-master cannot run anywhere
native_color: ip-slave allocation score on gv-neil2.bunchball.net: 0
native_color: ip-slave allocation score on gv-neil0.bunchball.net: 0
native_color: ip-slave allocation score on gv-neil3.bunchball.net: -1000000

So, here's my confusion: I thought a colocation constraint with a score
of other than +/- infinity was "advisory": the scores would be blended
together.

I added two extra location rules to add 1000 to the allocation scores for ip-master
and ip-slave on the mysql machines; then things started working "as expected".

So, finally, here are my questions:

1. Is the actual scheduling rule that a service will not be started if it has
    a negative allocation score?

2. The logic I would have preferred to use for positioning the ip resources was
    "must be colocated with either mysql0 or mysql1".  However, there seems to be
    no way to express this in a colocation rule.  Am I correct?  Is there a better
    way.

3. Even more high level: is there a better model for how to move service addresses
    around for this use case?

As always, thanks much for your time.

     Neil





More information about the Pacemaker mailing list