zoukankan      html  css  js  c++  java
  • 慕课学习记录_keepalived 安装记录

    keepalived 下载地址 

    1.解压 tar -zxvf keepalived-2.0.18.tar.gz

    2.进入到keepalived解压文件目录

      ./configure --prefix=/usr/local/keepalived --sysconf=/etc

      prefix:keepalived安装的位置

      sysconf:keepalived核心配置文件所在位置,固定位置,改成其他位置则keepalived启动不了,/var/log/messages中会报错

    3.提示错误信息

      *** WARNING - this build will not support IPVS with IPv6. Please install libnl/libnl-3 dev libraries to support IPv6 with IPVS.

      yum -y install libnl libnl-devel 

      执行后再次执行 ./configure --prefix=/usr/local/keepalived --sysconf=/etc

    4.make && make install

    5.进入到/etc/keepalived,该目录下为keepalived核心配置文件

      通过命令 vim keepalived.conf 打开配置文件

      

      启动服务

       

       ps -ef|grep keepalived

      

       查看端口是否启动 ip addr

      

    6.将服务注册到系统中

      在解压的目录中/home/software/keepalived-2.0.18/keepalived/etc 中 将两个配置文件拷贝到 /etc/ 目录中

        cp init.d/keepalived /etc/init.d/

        cp sysconfig/keepalived /etc/sysconfig/

    7.系统重启注册服务

      systemctl daemon-reload

      systemctl stop / start / restart keepalived.service

    8.Centos7 keepalived 防火墙设置

      firewall-cmd --direct --permanent --add-rule ipv4 filter INPUT 0 --destination 224.0.0.18 --protocol vrrp -j ACCEPT

      firewall-cmd --direct --permanent --add-rule ipv4 filter OUTPUT 0 --destination 224.0.0.18 --protocol vrrp -j ACCEPT

      firewall-cmd --reload

     

    9.设置keepalived 监听nginx脚本

      到 /etc/keepalived 目录下执行 vim /etc/keepalived/check_nginx_alive_or_not.sh 创建脚本

      

       对 脚本添加执行权限  chmod +x /etc/keepalived/check_nginx_alive_or_not.sh 

       再设置 keepalived的启动实例脚本
      

       最后重启keepalived 服务 systemctl restart keepalived

    10.双主热备配置实现 131 与 135 两台服务器互为主备关系

      131 主机 keepalived 配置

      

       135 的keepalived 配置文件配置

      

       当131 主机服务down后 161 162 vrrp虚拟IP 会转移到 135服务器上

      

     

     

     

  • 相关阅读:
    Kubernetes Jenkins动态创建Slave
    运维故障汇总
    Spinnaker调用Jenkins API 返回403错误
    linux删除文件空间不释放问题解决
    华为 路由交换之DHCP
    华为 路由交换之PPPoE
    关于==和equals的探索
    springboot&mybatis 增删改查系列(二)
    springboot&mybatis 增删改查系列(一)
    nginx简单使用(windows)
  • 原文地址:https://www.cnblogs.com/lixuchun/p/13525762.html
Copyright © 2011-2022 走看看