Exchange 2016 负载均衡LVS+Keepalived

网友投稿 841 2022-09-14

Exchange 2016 负载均衡LVS+Keepalived

Exchange 2016 负载均衡LVS+Keepalived

接上个博客,邮件系统中部署了3台邮件服务器。下面使用 LVS+Keepalived 实现owa负载均衡。

一、安装所需软件,如下所示:

[root@171 ~]# cat /etc/redhat-release CentOS Linux release 7.3.1611 (Core) [root@171 ~]# yum install keepalived -y #yum安装keepalived [root@171 ~]# rpm -qa keepalived #查看keepalived版本 keepalived-1.3.5-19.el7.x86_64 [root@171 ~]# yum install ipvsadm -y #安装lvs [root@171 ~]# cat /etc/keepalived/keepalived.conf [root@171 ~]# systemctl restart keepalived #重启keepalived [root@171 ~]# systemctl enable keepalived #开机启动keepalived

二、配置 keepalived

[root@171 keepalived]# cat /etc/keepalived/keepalived.conf ! Configuration File for keepalived global_defs { notification_email { acassen@firewall.loc failover@firewall.loc sysadmin@firewall.loc } notification_email_from Alexandre.Cassen@firewall.loc smtp_server 192.168.200.1 smtp_connect_timeout 30 router_id LVS_DEVEL vrrp_skip_check_adv_addr vrrp_strict vrrp_garp_interval 0 vrrp_gna_interval 0 } vrrp_instance VI_1 { state MASTER interface ens33 virtual_router_id 51 priority 100 advert_int 1 authentication { auth_type PASS auth_pass 1111 } virtual_ipaddress { #设置VIP为192.168.3.170 192.168.3.170 } } virtual_server 192.168.3.170 0 { delay_loop 6 lb_algo rr lb_kind DR persistence_timeout 50 protocol TCP real_server 192.168.3.232 0 { #设置集群中的服务器192.168.3.232 weight 1 TCP_CHECK { connect_timeout 3 nb_get_retry 3 delay_before_retry 3 } } real_server 192.168.3.233 0 { #设置集群中的服务器192.168.3.233 weight 1 TCP_CHECK { connect_timeout 3 nb_get_retry 3 delay_before_retry 3 } } real_server 192.168.3.234 0 { #设置集群中的服务器192.168.3.234 weight 1 TCP_CHECK { connect_timeout 3 nb_get_retry 3 delay_before_retry 3 } } }

三、修改 /etc/sysctrl.conf 文件

vi /etc/sysctrl.conf net.ipv4.ip_forward = 1 #开启路由转发功能。往指定地方转发 net.ipv4.conf.all.send_redirects = 0 #禁止转发重定向报文 net.ipv4.conf.ens33.send_redirects = 0 #禁止ens33转发重定向报文,ens33是网卡名,根据实际需要填写 net.ipv4.conf.default.send_redirects = 0 #禁止转发默认重定向报文

四、配置 ipvs。可不配置,keepalived里集成了lvs配置代码,更改 keepalived.conf 会设置ipvs

ipvsadm -C # -C clear the virtual server table清除ipvs所有的值 ipvsadm -A -t 192.168.3.170:443 -s rr #大写A,把到123:80的流量转出去 ipvsadm -a -t 192.168.3.170:443 -r 192.168.3.232:443 -g #找170:443,注抛给232:443。小g表示 DR模式,直连路由网关 ipvsadm -a -t 192.168.3.170:443 -r 192.168.3.233:443 -g #找170:443,注抛给233:443。小g表示 DR模式,直连路由网关 ipvsadm -a -t 192.168.3.170:443 -r 192.168.3.234:443 -g #找170:443,注抛给234:443。小g表示 DR模式,直连路由网关 ipvsadm-save > /etc/sysconfig/ipvsadm #永久保存 systemctl enable ipvsadm #ipvs开机自启动 ipvsadm -Lnc 查看ipvs访问过程 ipvsadm -Ln 检查ipvs本机规则

五、Exchange 服务器配置环回网卡

netsh interface ipv4 set interface "本地连接" weakhostreceive=enabled netsh interface ipv4 set interface "本地连接" weakhostsend=enabled netsh interface ipv4 set interface "环回网卡" weakhostreceive=enabled netsh interface ipv4 set interface "环回网卡" weakhostsend=enabled

六、访问测试

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:「运维有小邓」如何配置密码策略 - 概述和指南
下一篇:浅论系统重装的几种方法(二)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~