美文网首页
搭建keepalived实现VIP漂移

搭建keepalived实现VIP漂移

作者: Anwar_ec28 | 来源:发表于2018-11-06 16:37 被阅读0次

    一、更改配置yum源

        1.备份:mv

    /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

        2.下载阿里源:wget -O

    /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

        3.缓存:yum makecache

    二、安装lrzsz

        1.yum -y install lrzsz

    三、安装keepalived

    1.yum -y install keepalived

    2.创建目录

      mkdir /data/UnicomSMS/Keepalived

      mkdir /data/UnicomSMS/Keepalived/lock

      mkdir /data/UnicomSMS/Keepalived/lock/subsys

    四、修改配置文件

    Master

    [if !vml]

    [endif]

    Slave

    [if !vml]

    [endif]

    Nginx检查脚本

    [if !vml]

    [endif]

    五、启动测试

    /etc/init.d/keepalived

    start

    [if !vml]

    [endif]

    六、VIP漂移测试

    正常情况

    [if !vml]

    [endif]

    停到主上的keepalived vip地址会飘向备

    [if !vml]

    [endif]

    在把主上的keepalived启动vip会抢占到主

    [if !vml]

    [endif]

    七、方便管理

    1.ln -s /var/lock/subsys/keepalived /data/UnicomSMS/Keepalived/lock/subsys/

    2.ln -s /etc/keepalived/keepalived.conf /data/UnicomSMS/Keepalived/

    3.ln -s /etc/keepalived/nginx_check.sh/data/UnicomSMS/Keepalived/

    相关文章

      网友评论

          本文标题:搭建keepalived实现VIP漂移

          本文链接:https://www.haomeiwen.com/subject/ztbuxqtx.html