centso 7 keepalived 配置脚本

#!/bin/bash
#This is keepalived bashshell.
#MASTER/BACKUP
yum install -y openssl openssl-devel keepalived
vim /etc/keepalived/keepalived.conf
sed -i 's/MASTER/BACKUP/g' /etc/keepalived/keepalived.conf
sed -i 's/eth0/ens33/g' /etc/keepalived/keepalived.conf
sed -i 's/priority 100/priority 80/' /etc/keepalived/keepalived.conf
sudo systemctl start keepalived
sudo systemctl enable keepalived

#!/bin/bash

while true
do
if [ `ip a show eth0 |grep 10.0.0.3|wc -l` -ne 0 ]
then
    echo "keepalived is error!"
else
    echo "keepalived is OK !"
fi
done

 

你可能感兴趣的:(centso 7 keepalived 配置脚本)