As suggested in another reply, look into colocation
constraints. If you only use primitive resources (no clones
or master/slave resources), you could also use a group
instead of single resources. In fact, groups are just a
syntax shortcut for colocation constraints between all
resources within that group, but that happens in the
background.

I only use primitive - the following two actually:

type IPaddr2 for virtual ip and a script, both should only run on one server in the 
cluster, the others are "dumb".

I looked into one example from the current documentation:

<group id=”grp_webserver”>
<primitive type=”datadisk” class=”heartbeat”>
...
</primitive>
<primitive type=”Filesystem” class=”ocf”>
...
</primitive>
<primitive type=”IPaddr2” class=”ocf”>
...
</primitive>
<primitive type=”apache” class=”ocf”>
...
</primitive>
</group>

i currently have

<resources>
      <primitive id="ip_resource_1" class="ocf" type="IPaddr" 
provider="heartbeat">
        <instance_attributes id="inst_attr">
          <attributes>
<nvpair name="ip" value="@VIRTUAL_IP@" id="vip1"/> </attributes>
        </instance_attributes>
      </primitive>
      <primitive id="myscript" class="heartbeat" type="myscript-haswitch" 
provider="heartbeat"/>
    </resources>

so when i just put <group id=”some_id”> around these primitives, it should work 
out of the box? Both ressources will only always run on the same node, if that node 
goes offline another node will manage both ressources again?

Yes.

Groups are colocated and ordered by default. That means the cluster decides where the group should run and then starts the resources one after another on that node. If one resource (for whatever reason) cannot run on that node anymore, the cluster will move the group with all its resources to another node.

Regards
Dominik
_______________________________________________
Linux-HA mailing list
Linux-HA@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems

Reply via email to