[Pacemaker] custom resource-agent

Peter Romfeld peter.romfeld.hk at gmail.com
Mon Sep 30 08:54:03 EDT 2013


Hi,

I am running a mysql-cluster in aws with pacemaker/drbd. I would like to
run a script at failover to reassign the secondary IP for VIP.

something like:

primitive fvip ocf:heartbeat:AWSFIP \
params fvip="172.32.32.11" region="ap-southeast-1"
colocation mysql_on_drbd inf: fvip mysql ms_drbd_mysql:Master
order mysql_after_drbd inf: ms_drbd_mysql:promote fvip:start mysql:start

i copied the dummy script and adjusted it a bit:
<parameter name="fvip" unique="1" required="1">
<longdesc lang="en">
The IPv4 address to be configured in dotted quad notation, for example
"192.168.1.1".
</longdesc>
<shortdesc lang="en">IPv4 address</shortdesc>
<content type="string" default="" />
</parameter>

<parameter name="region" unique="1" required="1">
<longdesc lang="en">
The name of the AWS region
</longdesc>
<shortdesc lang="en">AWS region</shortdesc>
<content type="string"/>
</parameter>
Instance_ID=`/usr/bin/curl --silent
http://169.254.169.254/latest/meta-data/instance-id`
ENI_ID=`aws ec2 describe-instances --instance-id $Instance_ID --region
$OCF_RESKEY_region | grep NetworkInterfaceId | cut -d '"' -f 4`
awsfip_start() {
    awsfip_monitor
    if [ $? =  $OCF_SUCCESS ]; then
return $OCF_SUCCESS
    fi
aws ec2 assign-private-ip-addresses --network-interface-id $ENI_ID
--private-ip-addresses $OCF_RESKEY_fvip --allow-reassignment --region
$OCF_RESKEY_region
        sleep 4
aws ec2 assign-private-ip-addresses --network-interface-id $ENI_ID
--private-ip-addresses $OCF_RESKEY_fvip --allow-reassignment --region
$OCF_RESKEY_region
    touch ${OCF_RESKEY_state}
}

the aws commands itseld are working, i just have problems to use the
"params" variables in it.

Thanks for advise!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.clusterlabs.org/pipermail/pacemaker/attachments/20130930/549c121e/attachment-0002.html>


More information about the Pacemaker mailing list