lvs+keepalived主主模式

keepalived实验图:
这里写图片描述
实验环境介绍:

操作系统:Centos7.2
VIP:192.168.233.100
VIP:192.168.233.100
RIP:192.168.233.131
RIP:192.168.233.132

软件部署介绍:

lvs+keepalivd(1) (backup master)

一、环境检查:
关闭系统防火墙

 systemctl stop firewalld.service

检查系统是否支持ip_vs

 modprobe ip_vs 加载ip_vs模块
 lsmod |grep ip_vs 查询模块

二、配置keepalived

(1)安装keepalived,并配置lvs

yum install keepalived -y
yum install ipvsadm -y

(2)主配置文件路径

vim /etc/keepalived/keepalived.conf

配置文件如下:

! Configuration File for keepalived

global_defs {
   notification_email {
   root@localhost
   }
   notification_email_from admin@localhost
   smtp_server 127.0.0.1
   smtp_connect_timeout 10
   router_id 51
}

vrrp_instance VI_1 {
    state BACKUP
    interface eno16777736
    virtual_router_id 51
    priority 90
    advert_int 3
    authentication {
        auth_type PASS
        auth_pass 123.com
    }
    virtual_ipaddress {
        192.168.233.100
    }
}

virtual_server 192.168.233.100 80 {
    delay_loop 3
    lb_algo rr
    lb_kind DR
    nat_mask 255.255.255.0
    persistence_timeout 300
    protocol TCP

    real_server 192.168.233.131 80 {
        weight 1
        HTTP_GET {
            url {
              path /var/www/lighttpd/index.html
              digest 389975d8d57ca94e672162998e06c017
            }
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
        }
    }
   real_server 192.168.233.132 80 {
        weight 1
        HTTP_GET {
            url {
              path /var/www/lighttpd/index.html
              digest 389975d8d57ca94e672162998e06c017
            }
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
        }
    }
}


vrrp_instance VI_2 {
    state MASTER
    interface eno16777736
    virtual_router_id 52
    priority 100
    advert_int 3
    authentication {
        auth_type PASS
        auth_pass qq.com
    }
    virtual_ipaddress {
        192.168.233.101
    }
}

virtual_server 192.168.233.101 80 {
    delay_loop 3
    lb_algo rr
    lb_kind DR
    nat_mask 255.255.255.0
    persistence_timeout 300
    protocol TCP

    real_server 192.168.233.131 80 {
        weight 1
        HTTP_GET {
            url {
              path /var/www/lighttpd/index.html
              digest 389975d8d57ca94e672162998e06c017
            }
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
        }
    }
   real_server 192.168.233.132 80 {
        weight 1
        HTTP_GET {
            url {
              path /var/www/lighttpd/index.html
              digest 389975d8d57ca94e672162998e06c017
            }
            connect_timeout 3
            nb_get_retry 
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值