[ClusterLabs] start service after filesystemressource

Ken Gaillot kgaillot at redhat.com
Fri Nov 20 10:06:10 EST 2015


On 11/20/2015 07:38 AM, haseningo at gmx.de wrote:
> Hi,
> I want to start several services after the drbd ressource an the filessystem is 
> avaiable. This is my current configuration:
> node $id="184548773" host-1 \
>          attributes standby="on"
> node $id="184548774" host-2 \
>          attributes standby="on"
> primitive collectd lsb:collectd \
>          op monitor interval="10" timeout="30" \
>          op start interval="0" timeout="120" \
>          op stop interval="0" timeout="120"
> primitive failover-ip1 ocf:heartbeat:IPaddr \
>          params ip="192.168.6.6" nic="eth0:0" cidr_netmask="32" \
>          op monitor interval="10s"
> primitive failover-ip2 ocf:heartbeat:IPaddr \
>          params ip="192.168.6.7" nic="eth0:1" cidr_netmask="32" \
>          op monitor interval="10s"
> primitive failover-ip3 ocf:heartbeat:IPaddr \
>          params ip="192.168.6.8" nic="eth0:2" cidr_netmask="32" \
>          op monitor interval="10s"
> primitive res_drbd_export ocf:linbit:drbd \
>          params drbd_resource="hermes"
> primitive res_fs ocf:heartbeat:Filesystem \
>          params device="/dev/drbd0" directory="/mnt" fstype="ext4"
> group mygroup failover-ip1 failover-ip2 failover-ip3 collectd
> ms ms_drbd_export res_drbd_export \
>          meta notify="true" master-max="1" master-node-max="1" clone-max="2" 
> clone-node-max="1"
> location cli-prefer-collectd collectd inf: host-1
> location cli-prefer-failover-ip1 failover-ip1 inf: host-1
> location cli-prefer-failover-ip2 failover-ip2 inf: host-1
> location cli-prefer-failover-ip3 failover-ip3 inf: host-1
> location cli-prefer-res_drbd_export res_drbd_export inf: hermes-1
> location cli-prefer-res_fs res_fs inf: host-1

A word of warning, these "cli-" constraints were added automatically
when you ran CLI commands to move resources to specific hosts. You have
to clear these when you're done with whatever the move was for,
otherwise the resources will only run on those nodes from now on.

If you're using pcs, "pcs resource clear <resource-id>" will do it.

> colocation c_export_on_drbd inf: mygroup res_fs ms_drbd_export:Master
> order o_drbd_before_services inf: ms_drbd_export:promote res_fs:start
> property $id="cib-bootstrap-options" \
>          dc-version="1.1.10-42f2063" \
>          cluster-infrastructure="corosync" \
>          stonith-enabled="false" \
>          no-quorum-policy="ignore" \
>          last-lrm-refresh="1447686090"
> #vim:set syntax=pcmk
> I don't found the right way, to order the startup of new services (example 
> collectd), after the /mnt is mounted. Can you help me?

As other posters mentioned, order constraints and/or groups will do
that. Exact syntax depends on what CLI tools you use, check their man
pages for details.




More information about the Users mailing list