[Linux-HA] Master/Slave OCF script
Andrew Beekhof
andrew at beekhof.net
Mon Mar 22 14:45:10 MDT 2010
On Mon, Mar 22, 2010 at 12:50 PM, Maciej Lotkowski
<maciej.lotkowski at gmail.com> wrote:
> On Fri, Mar 19, 2010 at 5:16 PM, Lars Ellenberg
> <lars.ellenberg at linbit.com> wrote:
>> On Fri, Mar 19, 2010 at 03:33:09PM +0100, Maciej Lotkowski wrote:
>>> Hi,
>>>
>>> I'm trying to write OCF script for Redis
>>> (http://code.google.com/p/redis/). I need two nodes and master-slave
>>> behavior. My cib.xml looks like this:
>>>
>>> <configuration>
>>> <crm_config>
>>> <cluster_property_set id="cib-bootstrap-options">
>>> <nvpair id="cib-bootstrap-options-dc-version" name="dc-version"
>>> value="1.0.4-2ec1d189f9c23093bf9239a980534b661baf782d"/>
>> ^^^^^
>>
>>> <nvpair id="redis-target-role" name="target-role" value="Master"/>
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>
>>> I set master-max to 1, so there should be only one master node, but
>>> after promoting first node Pacemaker keeps trying to promote second
>>> node.
>>
>> Known bug in that version with that target-role.
>> upgrade (or delete the target-role setting, and upgrade anyways).
>
> Thanks. I did upgrade and it works like a charm, but I have a new problem.
>
> I have an ip resource which follows master. In case of master failure,
> Pacemaker demotes and restarts failed Redis resource and then promotes
> a new master. It takes few minutes to start Redis and load a database,
> so for this period of time the ip is down, since there is no master.
> How can I define a rule, which would instruct Pacemaker to first
> promote and move ip resource to the second to node, and then restart
> failed "old" master. I was trying to came up with something, but I
> couldn't find way to specify rule regarding two different nodes.
Its not currently possible I'm afraid.
>
>
> <configuration>
> <crm_config>
> <cluster_property_set id="cib-bootstrap-options">
> <nvpair id="cib-bootstrap-options-dc-version"
> name="dc-version"
> value="1.0.7-6e1815972fc236825bf3658d7f8451d33227d420"/>
> <nvpair id="cib-bootstrap-options-cluster-infrastructure"
> name="cluster-infrastructure" value="openais"/>
> <nvpair id="cib-bootstrap-options-no-quorum-policy"
> name="no-quorum-policy" value="ignore"/>
> <nvpair id="cib-bootstrap-options-stonith-enabled"
> name="stonith-enabled" value="false"/>
> <nvpair id="cib-bootstrap-options-expected-quorum-votes"
> name="expected-quorum-votes" value="2"/>
> </cluster_property_set>
> </crm_config>
> <nodes>
> <node id="noc-test-10" uname="noc-test-10" type="normal"/>
> <node id="noc-test-20" uname="noc-test-20" type="normal"/>
> </nodes>
> <resources>
> <master id="redis">
> <meta_attributes id="ms-drbd0-meta_attributes">
> <nvpair id="ms-drbd0-meta_attributes-clone-max"
> name="clone-max" value="2"/>
> <nvpair id="ms-drbd0-meta_attributes-notify" name="notify"
> value="false"/>
> <nvpair id="ms-drbd0-meta_attributes-globally-unique"
> name="globally-unique" value="false"/>
> <nvpair id="ms-drbd0-meta_attributes-target-role"
> name="target-role" value="Master"/>
> <nvpair id="redis-unique-5" name="migration-threshold" value="0"/>
> </meta_attributes>
> <primitive class="ocf" id="redis-master" provider="linbit"
> type="redis-master">
> <meta_attributes id="redis-meta-1">
> <nvpair id="redis-unique-3" name="failure-timeout" value="1s"/>
> <nvpair id="redis-unique-4" name="migration-threshold" value="0"/>
> </meta_attributes>
> <operations>
> <op id="drbd0-monitor-59s" interval="10s" name="monitor"
> role="Master" timeout="10s" on-fail="block"/>
> <op id="drbd0-monitor-60s" interval="9s" name="monitor"
> role="Slave" timeout="10s"/>
> <op id="drbd0-o-2" name="start" interval="0" timeout="10m"/>
> <op id="drbd0-o-3" name="stop" interval="0" timeout="10s"/>
>
> </operations>
> </primitive>
> </master>
> <primitive class="ocf" id="ip-lan-1" provider="heartbeat" type="IPaddr2">
> <instance_attributes id="ip-instance_attributes">
> <nvpair id="ip-instance_attributes-ip" name="ip" value="10.1.49.138"/>
> <nvpair id="ip-instance_attributes-nic" name="nic" value="eth1"/>
> <nvpair id="ip-instance_attributes-cidr_netmask"
> name="cidr_netmask" value="24"/>
> </instance_attributes>
> <operations>
> <op id="ip-monitor-21s" interval="21s" name="monitor" timeout="5s"/>
> </operations>
> </primitive>
> </resources>
> <constraints>
> <rsc_order first="redis" first-action="promote"
> id="ms-drbd0-before-storage" score="INFINITY" then="ip-lan-1"
> then-action="start"/>
> <rsc_colocation id="storage-on-ms-drbd0" rsc="ip-lan-1"
> score="INFINITY" with-rsc="redis" with-rsc-role="Master"/>
> </constraints>
> </configuration>
>
>
> --
> Maciej Lotkowski
> _______________________________________________
> Linux-HA mailing list
> Linux-HA at lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha
> See also: http://linux-ha.org/ReportingProblems
More information about the Linux-HA
mailing list