Nginx(三)——高可用

在两台机器上都要安装Nginx。

两台机器上都安装keepalived

service keepalived start

service keepalived stop

service keepalived restart

第三步:

查看当前机器的网卡

最后,master上的配置

备份机器上的配置

创建nginx_check.sh

A='ps -C nginx --no-header | wc -l'
if [ $A -eq 0 ];then
    /opt/nginx/sbin/nginx
    sleep 2
    if [ 'ps -C nginx --no-header | wc -l' -eq 0 ];then
        killall keepalived
    fi
fi

修改权限

猜你喜欢

转载自blog.csdn.net/csdn_kenneth/article/details/83387057
今日推荐