blob: e2bde52da612153b14c00985e7efd7279bb4315c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
#!/bin/sh
# ctdb event script for NFS tickle acks
. $CTDB_BASE/functions
service_name="nfs"
service_start="mkdir -p $CTDB_BASE/state/nfstickle;mkdir -p $NFS_TICKLE_SHARED_DIRECTORY/`hostname`;echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle"
service_reconfigure=$service_start
loadconfig
ctdb_start_stop_service
[ -z "$NFS_TICKLE_SHARED_DIRECTORY" ] && exit 0
case $cmd in
startup)
ctdb_service_start
;;
takeip)
iface=$1
ip=$2
# first send a grat arp, to ensure the client knows the updated
# mac address for this IP
ctdb gratiousarp $ip $iface
# send tickle acks for all the connections the old server had
for f in $NFS_TICKLE_SHARED_DIRECTORY/*/$ip; do
[ -f $f ] && cat $f | while read dest; do
# send three, in case of lost packets
echo "Sending NFS tickle ack for $ip to $dest"
for i in `seq 1 3`; do
ctdb tickle $dest $ip:2049
done
done
done
;;
monitor)
mydir=$NFS_TICKLE_SHARED_DIRECTORY/`hostname`
rm -f $mydir/*
# record our connections to shared storage
netstat -tn |egrep '^tcp[[:space:]]+[0-9]+[[:space:]]+[0-9]+[[:space:]]+[0-9\.]+:2049.*ESTABLISHED' |
awk '{print $4" "$5}' |
while read dest src; do
ip=${dest%:*}
echo $src >> $mydir/$ip
done
;;
esac
# ignore unknown commands
exit 0
|