Changes between Version 11 and Version 12 of keepalived


Ignore:
Timestamp:
07/19/22 07:31:30 (2 years ago)
Author:
krit
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • keepalived

    v11 v12  
    6868}}}
    6969
     70
     71After wake up, we need to start docker database and sync to mysql group replication. In command '''docker exec -i''', we use only '''-i''' not '''-it''' because '''-t''' was a tty console when run as a script it was not from tty console so we need to use only '''-i''' (interactive mode)
     72{{{
     73#!/usr/bin/bash
     74
     75logfile=/tmp/nodedb1.log
     76container_name=nodedb1
     77/usr/bin/docker start $container_name
     78echo "docker start $container_name" >> $logfile
     79sleep 10
     80if [ "$( docker container inspect -f '{{.State.Status}}' $container_name )" == "running" ]; then
     81   echo "$container_name is running" >> $logfile
     82else
     83   echo "$container_name is not running, we will start again" >> $logfile
     84   /usr/bin/docker start $container_name
     85   echo "start $container_name Done!!" >> $logfile
     86fi
     87
     88if [ "$( docker container inspect -f '{{.State.Status}}' $container_name )" == "running" ]; then
     89   cmd1="/usr/bin/docker exec -i $container_name mysql -uroot -pmypass -e \"STOP GROUP_REPLICATION;\" \
     90                      -e \"SET @@GLOBAL.group_replication_group_name='aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee';\" \
     91                      -e \"SET @@GLOBAL.group_replication_local_address='$container_name:33061';\"\
     92                      -e \"SET @@GLOBAL.group_replication_group_seeds='$container_name:33061,nodedb2:33061,nodedb3:33061';\" \
     93                      -e \"change master to master_user='repl' for channel 'group_replication_recovery';\" \
     94                      -e \"START GROUP_REPLICATION;\"  "
     95   echo "$cmd1" >> $logfile
     96   eval "$cmd1" 2> /tmp/err.log 1>> $logfile
     97   sleep 10
     98   echo "$container_name join group_replication" >> $logfile
     99   cmd2="/usr/bin/docker exec -i $container_name mysql -uroot -pmypass -e \"SELECT * FROM performance_schema.replication_group_members;\" "
     100   echo "$cmd2" >> $logfile
     101   eval "$cmd2" 2> /tmp/err.log 1>> $logfile
     102else
     103   echo "$container_name still not start" >> $logfile
     104fi
     105
     106}}}
    70107For standby site (backup site ip 10.7.168.58) config can be found [attachment:keepalived_backup.tar here]