DNS服务器LVS方式负载均衡部署与测试
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
DNS服务器LVS方式负载均衡部署与测试测试环境:
本测试方案采用LVS(DR)+Keepalived部署高可用的DNS服务集群。
主机IP划分:
Master-LB:192.168.100.70
Backup-LB:192.168.100.30
RS1:192.168.100.40
RS2:192.168.100.60
Clinet:192.168.100.200
拓扑图:
LB-2:192.168.100.30Backup LB-1:192.168.100.70
Master DNS-RS1:192.168.100.40
DNS-RS2:192.168.100.60
1、配置Maste-LB 服务器:
1、 安装ipvsadm ;
yum install ipvsadm* -y
2、 安装keepalived
yum install keepalived -y
3、 配置配置keepalived
#cat /etc/keepalived/keepalived.conf
! Configuration File for keepalived
global_defs {
notification_email {
****************
}
**************************************************** smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id LVS_1
}
vrrp_instance VI_1 {
state MASTER
interface eth1
virtual_router_id 50
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.100.100
}
}
virtual_server 192.168.100.100 53 {
delay_loop 1
lb_algo rr
lb_kind DR
nat_mask 255.255.255.255
!persistence_timeout 50
protocol UDP
real_server 192.168.100.40 53 {
weight 1
MISC_CHECK {
misc_path "/usr/bin/dig -************************************.100.40+time=1+tries=5+fail>/dev/null"
misc_timeout 6
}
}
real_server 192.168.100.60 53 {
weight 1
MISC_CHECK {
misc_path "/usr/bin/dig -************************************.100.60+time=1+tries=5+fail>/dev/null"
misc_timeout 6
}
}
}
vrrp_instance VI_2 {
state MASTER
interface eth1
virtual_router_id 52
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.100.100
}
}
virtual_server 192.168.100.100 53 { delay_loop 1
lb_algo rr
lb_kind DR
nat_mask 255.255.255.255
!persistence_timeout 50
protocol TCP
real_server 192.168.100.40 53 {
weight 1
TCP_CHECK {
connect_timeout 5
nb_get_retry 3
connect_port 53
}
}
real_server 192.168.100.60 53 {
weight 1
TCP_CHECK {
connect_timeout 5
nb_get_retry 3
connect_port 53
}
}
}
4、启动keepalived的服务
service keepalived restart
5、查看配置是否生效
# ipvsadm –Ln
[root@localhost ~]# ipvsadm -Ln
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn TCP 192.168.100.100:53 rr
-> 192.168.100.40:53 Route 1 0 0
-> 192.168.100.60:53 Route 1 0 0