Mxs 1665 keepalived masterdown test (#171)
* add keepalived_masterdown test * add missing cnfs
This commit is contained in:
24
maxscale-system-test/keepalived_cnf/1.conf
Normal file
24
maxscale-system-test/keepalived_cnf/1.conf
Normal file
@ -0,0 +1,24 @@
|
||||
vrrp_script chk_myscript {
|
||||
script "/usr/bin/is_maxscale_running.sh"
|
||||
interval 2 # check every 2 seconds
|
||||
fall 2 # require 2 failures for KO
|
||||
rise 2 # require 2 successes for OK
|
||||
}
|
||||
|
||||
vrrp_instance VI_1 {
|
||||
state MASTER
|
||||
interface eth0
|
||||
virtual_router_id 51
|
||||
priority 150
|
||||
advert_int 1
|
||||
authentication {
|
||||
auth_type PASS
|
||||
auth_pass mypass
|
||||
}
|
||||
virtual_ipaddress {
|
||||
###virtual_ip###
|
||||
}
|
||||
track_script {
|
||||
chk_myscript
|
||||
}
|
||||
}
|
24
maxscale-system-test/keepalived_cnf/2.conf
Normal file
24
maxscale-system-test/keepalived_cnf/2.conf
Normal file
@ -0,0 +1,24 @@
|
||||
vrrp_script chk_myscript {
|
||||
script "/usr/bin/is_maxscale_running.sh"
|
||||
interval 2 # check every 2 seconds
|
||||
fall 2 # require 2 failures for KO
|
||||
rise 2 # require 2 successes for OK
|
||||
}
|
||||
|
||||
vrrp_instance VI_1 {
|
||||
state MASTER
|
||||
interface eth0
|
||||
virtual_router_id 51
|
||||
priority 100
|
||||
advert_int 1
|
||||
authentication {
|
||||
auth_type PASS
|
||||
auth_pass mypass
|
||||
}
|
||||
virtual_ipaddress {
|
||||
###virtual_ip###
|
||||
}
|
||||
track_script {
|
||||
chk_myscript
|
||||
}
|
||||
}
|
25
maxscale-system-test/keepalived_cnf/masterdown1.conf
Normal file
25
maxscale-system-test/keepalived_cnf/masterdown1.conf
Normal file
@ -0,0 +1,25 @@
|
||||
vrrp_script chk_myscript {
|
||||
script "/usr/bin/is_maxscale_running.sh"
|
||||
interval 2 # check every 2 seconds
|
||||
fall 2 # require 2 failures for KO
|
||||
rise 2 # require 2 successes for OK
|
||||
}
|
||||
|
||||
vrrp_instance VI_1 {
|
||||
state MASTER
|
||||
interface eth0
|
||||
virtual_router_id 51
|
||||
priority 150
|
||||
advert_int 1
|
||||
authentication {
|
||||
auth_type PASS
|
||||
auth_pass mypass
|
||||
}
|
||||
virtual_ipaddress {
|
||||
###virtual_ip###
|
||||
}
|
||||
track_script {
|
||||
chk_myscript
|
||||
}
|
||||
notify /usr/bin/notify_script.sh
|
||||
}
|
25
maxscale-system-test/keepalived_cnf/masterdown2.conf
Normal file
25
maxscale-system-test/keepalived_cnf/masterdown2.conf
Normal file
@ -0,0 +1,25 @@
|
||||
vrrp_script chk_myscript {
|
||||
script "/usr/bin/is_maxscale_running.sh"
|
||||
interval 2 # check every 2 seconds
|
||||
fall 2 # require 2 failures for KO
|
||||
rise 2 # require 2 successes for OK
|
||||
}
|
||||
|
||||
vrrp_instance VI_2 {
|
||||
state MASTER
|
||||
interface eth0
|
||||
virtual_router_id 51
|
||||
priority 100
|
||||
advert_int 1
|
||||
authentication {
|
||||
auth_type PASS
|
||||
auth_pass mypass
|
||||
}
|
||||
virtual_ipaddress {
|
||||
###virtual_ip###
|
||||
}
|
||||
track_script {
|
||||
chk_myscript
|
||||
}
|
||||
notify /usr/bin/notify_script.sh
|
||||
}
|
27
maxscale-system-test/keepalived_cnf/notify_script.sh
Executable file
27
maxscale-system-test/keepalived_cnf/notify_script.sh
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
TYPE=$1
|
||||
NAME=$2
|
||||
STATE=$3
|
||||
|
||||
OUTFILE=/tmp/state.txt
|
||||
touch $OUTFILE
|
||||
#OUTFILE=/home/vagrant/state.txt
|
||||
|
||||
case $STATE in
|
||||
"MASTER") echo "Setting this MaxScale node to active mode $TYPE $NAME $STATE" > $OUTFILE
|
||||
maxctrl alter maxscale passive false
|
||||
exit 0
|
||||
;;
|
||||
"BACKUP") echo "Setting this MaxScale node to passive mode $TYPE $NAME $STATE" > $OUTFILE
|
||||
maxctrl alter maxscale passive true
|
||||
exit 0
|
||||
;;
|
||||
"FAULT") echo "MaxScale failed the status check. $TYPE $NAME $STATE" > $OUTFILE
|
||||
maxctrl alter maxscale passive true
|
||||
exit 0
|
||||
;;
|
||||
*) echo "Unknown state $TYPE $NAME $STATE" > $OUTFILE
|
||||
exit 1
|
||||
;;
|
||||
esac
|
Reference in New Issue
Block a user