Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Won't Fix
-
None
-
CentOS Linux release 7.6.1810 (Core)
Description
Hi.
I tested keepalived 1.3.5 to duplicate maxscale 2.3.15.
The following documents were referenced.
https://mariadb.com/kb/en/mariadb-maxscale-23-maxscale-failover-with-keepalived-and-maxctrl/
We configured maxscale and keepalived on MAX1 and MAX2 respectively.
--------------------------------------------------------
#cat /etc/maxscale.conf
...
[MariaDB-Monitor]
type=monitor
module=mariadbmon
servers=server1,server2
auto_failover = true
auto_rejoin = true
...
---------------------------------------------------------
#cat /etc/keepalived/keepalived.conf
global_defs
{ script_user root enable_script_security }vrrp_script chk_maxscale
{ script "/usr/libexec/keepalived/is_maxscale_running.sh" #script "pidof maxscale" 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 enp0s3
virtual_router_id 10
priority 150 #MAX1=150, MAX2=100
advert_int 1
authentication
{ auth_type PASS auth_pass mypass }virtual_ipaddress
{ 192.168.100.10 }track_script
{ chk_maxscale } notify /usr/libexec/keepalived/notify_script.sh
}
---------------------------------------------------------
#cat is_maxscale_running.sh
#!/bin/bash
fileName="/usr/local/maxadmin_output.log"
rm $fileName
timeout 2s maxadmin list servers > $fileName
to_result=$?
if [ $to_result -ge 1 ]
then
echo Timed out or error, timeout returned $to_result
exit 3
else
echo MaxAdmin success, rval is $to_result
echo Checking maxadmin output sanity
grep1=$(grep server1 $fileName)
grep2=$(grep server2 $fileName)
if [ "$grep1" ] && [ "$grep2" ]
then
echo All is fine
exit 0
else
echo Something is wrong
service keepalived stop
exit 3
fi
fi
---------------------------------------------------------
#cat notify_script.sh
#!/bin/bash
TYPE=$1
NAME=$2
STATE=$3
OUTFILE=/usr/local/maxscale_state.log
case $STATE in
"MASTER") echo "Setting this MaxScale node to active mode" > $OUTFILE
maxctrl alter maxscale passive false
exit 0
;;
"BACKUP") echo "Setting this MaxScale node to passive mode" > $OUTFILE
maxctrl alter maxscale passive true
exit 0
;;
"FAULT") echo "MaxScale failed the status check." > $OUTFILE
maxctrl alter maxscale passive true
exit 0
;;
*) echo "Unknown state" > $OUTFILE
exit 1
;;
esac
--------------------------------------------------------
In our tests, stopping the maxscale (service maxscale stop) of the MASTER state node was successful without any issues with failover.
But
If you stop keepalived (service keepalived stop) of the MASTER state node, all maxscale nodes will change passive to false.
There is a problem with the HA architecture.
Please comment on this issue.