WinSrv2019使用DNS策略实现应用访问流量均衡分流

假设我有3台web服务器web01,web02,web03,对外的域名都是www.basehome.com.cn,那么我想让用户访问www.basehome.com.cn只是实现单纯的负载均衡而不检测后面是否正常提供服务,传统的作法咱们能够作DNS轮询,那么在这里我会使用DNS策略来实现流量均衡,而不是DNS轮询。架构以下:web

clip_image001

需求目标:当客户端访问www.basehome.com.cn时,我但愿web01承担50%的访问请求,web02和web03各自承担25%的访问请求。服务器

首先建立区域范围:架构

Add-DnsServerZoneScope -ZoneName "basehome.com.cn" -Name "web01ZoneScope"负载均衡

Add-DnsServerZoneScope -ZoneName "basehome.com.cn" -Name "web02ZoneScope"ide

Add-DnsServerZoneScope -ZoneName "basehome.com.cn" -Name "web03ZoneScope"测试

clip_image002

接下来添加记录到区域范围3d

Add-DnsServerResourceRecord -ZoneName "basehome.com.cn" -A -Name "www" -IPv4Address "10.0.0.10" -ZoneScope "web01ZoneScope"blog

Add-DnsServerResourceRecord -ZoneName "basehome.com.cn" -A -Name "www" -IPv4Address "10.0.0.11" -ZoneScope "web02ZoneScope"ip

Add-DnsServerResourceRecord -ZoneName "basehome.com.cn" -A -Name "www" -IPv4Address "10.0.0.12" -ZoneScope "web03ZoneScope"get

clip_image003

最后一步建立DNS策略

Add-DnsServerQueryResolutionPolicy -Name "BalancePolicy" -Action ALLOW -FQDN "eq,www.basehome.com.cn" -ZoneScope "web01ZoneScope,2;web02ZoneScope,1;web03ZoneScope,1" -ZoneName "basehome.com.cn"

clip_image004

OK,这里我就不作验证演示了,由于我没有那么多客户端来验证测试。

相关文章
相关标签/搜索