• keepalived双机热备,安装部署文档


    keepalived双击热备,安装部署文档:

    下载目录:/apps/keepalived-1.2.7.tar.gz

    1:---> yum install -y make wget

    2:---> yum install -y gcc openssl-devel popt-devel

    3:---> wget http://www.keepalived.org/software/keepalived-1.2.7.tar.gz

    4:---> tar -zxvf keepalived-1.2.7.tar.gz

    5:---> ./configure

    6:---> make && make install

    7:---> cd /apps/keepalived-1.2.7/keepalived/etc/keepalived

    8:---> 配置keepalived.conf 主(192.168.8.116)/备(192.168.8.117)

    主节点keepalived.conf:
        global_defs {
          router_id NodeA
        }
        vrrp_instance VI_1 {
          state MASTER #设置为主服务器
          interface eth0 #监测网络接口
          virtual_router_id 51 #主、备必须一样
          priority 100 #(主、备机取不同的优先级,主机值较大,备份机值较小,值越大优先级越高)
          advert_int 1 #VRRP Multicast广播周期秒数
          authentication {
            auth_type PASS #VRRP认证方式,主备必须一致
            auth_pass 1111 #(密码)
          }
          virtual_ipaddress {
            192.168.8.100/24 #VRRP HA虚拟地址
          }
        }

    备节点keepalived.conf:
        global_defs {
          router_id NodeB
        }
        vrrp_instance VI_1 {
          state BACKUP #设置为主服务器
          interface eth0 #监测网络接口
          virtual_router_id 51 #主、备必须一样
          priority 90 #(主、备机取不同的优先级,主机值较大,备份机值较小,值越大优先级越高)
          advert_int 1 #VRRP Multicast广播周期秒数
        authentication {
          auth_type PASS #VRRP认证方式,主备必须一致
          auth_pass 1111 #(密码)
           }
        virtual_ipaddress {
          192.168.8.100/24 #VRRP HA虚拟地址
           }
        }

    9:---> cp keepalived.conf /etc/

    10:---> cp keepalived.conf /etc/keepalived/

    11:---> cd /apps/keepalived-1.2.7/keepalived/bin

    12:---> cp keepalived /etc/init.d/

    13:---> cd /etc/init.d/

    14:---> chkconfig --add keepalived

    15:---> chkconfig keepalived on

    16:---> 设置keepalived日志 keepalived.log

    17:---> 默认日志存放在系统日志:/var/log/messages下 tail -f /var/log/messages

    18:---> 我们将日志单独存放 vim /etc/sysconfig/keepalived
                把KEEPALIVED_OPTIONS="-D" 修改为:KEEPALIVED_OPTIONS="-D -d -S 0"
                vim /etc/rsyslog.conf
                在文件末尾添加
                local0.*                                                     /var/log/keepalived.log

    19:---> 重启日志记录服务 /etc/init.d/rsyslog restart

    20:---> 启动keepalived /etc/init.d/keepalived start

    21:---> 查看log消息 tail -f /var/log/keepalived.log

    22:---> 通过ip a 命令查看虚拟ip:192.168.8.100/24绑定到了eth0上

    23:---> 通过虚拟ip:192.168.8.100 访问测试,116/117两台nginx,或者两台tomcat http服务器

    24:---> 关闭master keepalived 发现backup机器开始提供服务


     -END-

  • 相关阅读:
    用户控件
    垃圾弟弟
    如何解决“呈现控件时出错”的问题
    IE与FireFox差距
    NavigateUrl属性绑定
    table
    firefox不支持attachEvent,attach
    转 jQuery分类 
    GridView列数字、货币和日期的显示格式
    appendChild
  • 原文地址:https://www.cnblogs.com/jstarseven/p/7561288.html
Copyright © 2020-2023  润新知