Il 03/03/2014 10:45, Michael Schwartzkopff ha scritto:
Am Montag, 3. März 2014, 10:26:30 schrieb Giuliano Zorzi:
Hi all,
I'm stuck on something I thought to be very simple, but googling hasn't
helped me :(
I have a 2 node cluster with an IPaddress2 resource and a
pacemaker:pingd clone. The resource goes away from the node with pingd
value = 0 just fine.
Now I need to run a script on the "failed" node when it comes back but I
can't seem to find a way.
No. You make your resources depend on the result of the ping monitoring by a
location constraint and the score_attribute "pingd". So the ping resource
checks the availabilily of the hosts in the list and updates the result in the
pingd attribute of avery node.
If no host is available hte node gets 0 points and "multiplier" points for
every reachable host.
pacemaker will place your resource on the host that gathers most points. If
the contact is lost (0 points) the resource moves away. If the contact is
established again, it depends on the resource-stickiness, if the reource fails
back to the node.
BTW: you should use ocf:pacemaker:ping instead of the ocf:pacemaker:pingd
Be sure to have a monitor operation configured.
Thanks for the answer, but I'm too noob and I don't quite follow you :)
I think I understand how the resources are moved according to the pingd
score. What I need to to is to run a script when the pingd score changes
from 0 (node disconnected from the network) to gt 0 (node connected to
the network). This script will resync a database, so it's not a resource
(AFAIK) and it must run on the newly connected node (not on the node
that actually has the resource ipaddr2
I tried ClusterMon but it seems to work only when the clone resource is
started/stopped, not when the atrtibute value changes
Is there a way to have this done ?
As last resort I could use a cronjob and monitor the pingd attribute
with crm_attribute (crm_attribute --query --name=pingd --node node1
returns "name=pingd value=(null) Error performing operation: cib object
missing", any idea ?)
Any help will be greatly appreciated
TIA
giuliano
versions details
OS is centos 5
kernel is 2.6.18-194.26.1.el5 #1 SMP Tue Nov 9 12:54:40 EST 2010 i686
i686 i386 GNU/Linux
heartbeat-3.0.3-2.3.el5.i386.rpm
heartbeat-libs-3.0.3-2.3.el5.i386.rpm
pacemaker-1.0.12-1.el5.centos.i386.rpm
pacemaker-libs-1.0.12-1.el5.centos.i386.rpm
all from clusterlabs repo
crm config
primitive p_ping ocf:pacemaker:ping \
params host_list="10.0.0.254" multiplier="100" dampen="5s" \
op monitor interval="60" timeout="60" \
op start interval="0" timeout="60" \
op stop interval="0" timeout="60"
clone c_ping p_ping
primitive res_IPaddr2 ocf:heartbeat:IPaddr2 \
params ip="10.0.0.80" cidr_netmask="32" \
operations $id="res_IPaddr2-operations" \
op start interval="0" timeout="20" \
op stop interval="0" timeout="20" \
op monitor interval="10" timeout="20" start-delay="0"
location l_ping res_IPaddr2 \
rule $id="l_ping-rule" -inf: not_defined pingd or pingd lte 0
Better:
location l_ping res_IPaddr2 rule pingd: defined pingd
thanks, I'll change that
property $id="cib-bootstrap-options" \
dc-version="1.0.12-unknown" \
cluster-infrastructure="Heartbeat" \
stonith-enabled="false" \
no-quorum-policy="ignore" \
last-lrm-refresh="1393595832"
rsc_defaults $id="rsc-options" \
resource-stickiness="1000"
Well, you have a resource stickiness of "1000". A node only can gather 100
points from the ping resource. if both nodes have 100 points from ping, the
resource will not fail back. If you want to have fail-back lower the resource-
stickiness to 50. But why do you want a failback anyway?
in my case I don't want fallback :)
thanks
Giuliano
_______________________________________________
Pacemaker mailing list: Pacemaker@oss.clusterlabs.org
http://oss.clusterlabs.org/mailman/listinfo/pacemaker
Project Home: http://www.clusterlabs.org
Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
Bugs: http://bugs.clusterlabs.org