Created
January 30, 2015 10:42
-
-
Save meteozond/563c2a1178cdaa823bd6 to your computer and use it in GitHub Desktop.
Heartbeat ClusterIP resource manager
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# | |
# Description: wrapper of OCF RA clustgerip, based on original heartbeat RA. See | |
# OCF RA cluserip for more information. | |
# | |
# Author: Alexander Klimenko <[email protected]> | |
# Support: [email protected] | |
# License: GNU General Public License (GPL) | |
# Copyright: (C) 2005 International Business Machines | |
# | |
# Usage | |
# | |
# Supposed you've git two servers which traffic is ballanced with ClusterIP. | |
# | |
# First one: | |
# | |
# iptables -A INPUT -d 10.0.0.1 -i eth1 -j CLUSTERIP --new \ | |
# --hashmode sourceip-sourceport --clustermac 01:00:5E:00:00:20 \ | |
# --total-nodes 2 --local-node 1 | |
# | |
# Second: | |
# | |
# iptables -A INPUT -d 10.0.0.1 -i eth1 -j CLUSTERIP --new \ | |
# --hashmode sourceip-sourceport --clustermac 01:00:5E:00:00:20 \ | |
# --total-nodes 2 --local-node 2 | |
# | |
# To provide failover, update your /etc/ha.d/haresources like this: | |
# | |
# node1 clusterip::10.0.0.1::1 | |
# node2 clusterip::10.0.0.1::2 | |
# | |
PREFIX=/proc/net/ipt_CLUSTERIP | |
usage() { | |
echo "usage: $0 [clusterip] [node] $LEGAL_ACTIONS" | |
exit 1 | |
} | |
case $3 in | |
start) | |
echo +$2 > $PREFIX/$1 || true; | |
;; | |
stop) | |
echo -$2 > $PREFIX/$1 || true; | |
;; | |
status) | |
nodes=`cat $PREFIX/$1`; | |
if (echo "$nodes" | fgrep -q "$2"); then | |
echo 'ok'; | |
else | |
echo 'fail' | |
fi | |
;; | |
*) | |
usage | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment