summaryrefslogtreecommitdiffstats
path: root/ctdb
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronniesahlberg@gmail.com>2008-07-10 11:42:37 +1000
committerRonnie Sahlberg <ronniesahlberg@gmail.com>2008-07-10 11:42:37 +1000
commitaa0cab2aaa401e9a0113eaf3f575a561e76d5290 (patch)
treeb0407890fdeec13917238671ba68f968d5cd0607 /ctdb
parentefd840276bb80068557b28cee9cc1dd03b6930b0 (diff)
downloadsamba-aa0cab2aaa401e9a0113eaf3f575a561e76d5290.tar.gz
samba-aa0cab2aaa401e9a0113eaf3f575a561e76d5290.tar.xz
samba-aa0cab2aaa401e9a0113eaf3f575a561e76d5290.zip
Update to the LVS eventscript.
Do not assume all nodes are members of LVS so always deciding the recmaster will be lvsmaster wont work. Instead, Create the set of active LVS nodes as those nodes that are LVS capable and also HEALTHY. Except if ALL LVS capable nodes are unhealthy in which case we allow the unhealthy nodes to be part of the active set. In the active set, pick one of the active nodes as being the lvsmaster which will receive all incoming traffic and distribute it across the active lvs nodes in the cluster. (This used to be ctdb commit b2ccb891b81b041e2186e038b67bb4354b7892aa)
Diffstat (limited to 'ctdb')
-rwxr-xr-xctdb/config/events.d/91.lvs11
1 files changed, 8 insertions, 3 deletions
diff --git a/ctdb/config/events.d/91.lvs b/ctdb/config/events.d/91.lvs
index 678215b4a3b..4860030aeab 100755
--- a/ctdb/config/events.d/91.lvs
+++ b/ctdb/config/events.d/91.lvs
@@ -54,8 +54,11 @@ case $cmd in
ipvsadm -D -u $CTDB_LVS_PUBLIC_IP:0
kill_tcp_connections $CTDB_LVS_PUBLIC_IP
- # are we the recmaster ?
- ctdb isnotrecmaster >/dev/null 2>/dev/null || {
+ PNN=`ctdb pnn | sed -e "s/.*PNN://"`
+ LVSMASTER=`ctdb lvsmaster | sed -e "s/.*Node //" -e "s/ .*//"`
+
+ [ "$PNN" != "$LVSMASTER" ] && {
+ # we are not the lvs master so we have to
# change the ip address to have scope host so we wont respond
# to arps
ip addr del $CTDB_LVS_PUBLIC_IP/32 dev lo >/dev/null 2>/dev/null
@@ -70,10 +73,12 @@ case $cmd in
ipvsadm -A -t $CTDB_LVS_PUBLIC_IP:0 -p 9999 -s lc
ipvsadm -A -u $CTDB_LVS_PUBLIC_IP:0 -p 9999 -s lc
- ctdb status 2>/dev/null | egrep "^pnn:" | grep -v DISCONNECTED | grep -v "(THIS NODE)" | sed -e "s/^pnn:[0-9]* //" -e "s/[ ].*//" | while read IP; do
+ # add all nodes (except ourselves) to the lvs config
+ ctdb lvs | egrep -v "^$PNN:" | sed -e "s/.*://" | while read IP; do
ipvsadm -a -t $CTDB_LVS_PUBLIC_IP:0 -r $IP -g
ipvsadm -a -u $CTDB_LVS_PUBLIC_IP:0 -r $IP -g
done
+ # and add the localhost too
ipvsadm -a -t $CTDB_LVS_PUBLIC_IP:0 -r 127.0.0.1
ipvsadm -a -u $CTDB_LVS_PUBLIC_IP:0 -r 127.0.0.1