Changes between Version 18 and Version 19 of keepalived


Ignore:
Timestamp:
09/20/22 00:00:42 (2 years ago)
Author:
krit
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • keepalived

    v18 v19  
    111111}}}
    112112For standby site (backup site ip 10.7.168.58) config can be found [attachment:keepalived_backup.tar here]
     113
     114------------------------------------------
     115== keepalived Backup site check DB Group Replicate ==
     116
     117{{{
     118#!sh
     119
     120#!/usr/bin/bash
     121logfile=/tmp/keepalived.log
     122echo "Time: $(date). keepalive log -------" >> $logfile
     123
     124IP_MASTER="192.168.81.12"
     125STR_CHECK="ONLINE"
     126
     127#/usr/bin/unison > /dev/null 2>&1
     128/bin/ping -c 2 -W 1 192.168.81.12 > /dev/null 2>&1
     129status=$?
     130echo 'ping ' $status
     131if [ $status -eq 0 ]
     132then
     133   all_result=`/usr/bin/docker exec -i nodedb1 mysql -uroot -pmypass -e 'SELECT * FROM performance_schema.replication_group_members;'`
     134   online=$(echo $all_result | grep "$IP_MASTER" | awk '{ print $12}' )
     135   if [[ "$online" == *"$STR_CHECK"* ]]
     136   then
     137       echo "Master node OK" >> $logfile
     138       exit 1 # All good. DB master reachable
     139   else
     140       echo "Master node Fail" >> $logfile
     141       exit 0 # Failover trigger
     142   fi
     143else
     144   echo "Master node Fail" >> $logfile
     145   exit 0 # Failover trigger
     146fi
     147}}}