- 论坛徽章:
- 0
|
初次配置LVS+Keepalived,
vip:172.16.10.8
dr2:172.16.10.9 BACKUP
dr1:172.16.10.10 MASTER
rip1:172.16.10.11
rip2:172.16.10.12
已上IP可以互PING通
配置文件如下:
[root@DR1 keepalived]# cat 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 172.16.10.1
smtp_connect_timeout 30
router_id LVS_DEVEL
}
vrrp_instance VI_1 {
state MASTER
interface eth2
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
172.16.10.8
}
}
virtual_server 172.16.10.8 80 {
delay_loop 6
lb_algo wlc
lb_kind DR
nat_mask 255.255.255.0
persistence_timeout 50
protocol TCP
real_server 172.16.10.11 80 {
weight 2
TCP_CHECK{
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
connect_port 80
}
}
real_server 172.16.10.12 80 {
weight 4
TCP_CHECK{
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
connect_port 80
}
}
}
[root@DR1 keepalived]#
keepalived启动正常,但是只有一个真实主机可以被成功添加。
[root@DR1 keepalived]# ipvsadm -Ln
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress ort Scheduler Flags
-> RemoteAddress ort Forward Weight ActiveConn InActConn
TCP 172.16.10.8:80 wlc persistent 50
-> 172.16.10.11:80 Route 1 0 0
[root@DR1 keepalived]#
keepalived启动日志如下:
Jan 14 22:17:11 dr1 Keepalived[13310]: Starting Keepalived v1.2.6 (01/14,2013)
Jan 14 22:17:11 dr1 Keepalived[13311]: Starting Healthcheck child process, pid=13313
Jan 14 22:17:11 dr1 Keepalived[13311]: Starting VRRP child process, pid=13314
Jan 14 22:17:11 dr1 Keepalived_healthcheckers[13313]: Interface queue is empty
Jan 14 22:17:11 dr1 Keepalived_healthcheckers[13313]: Netlink reflector reports IP 172.16.10.10 added
Jan 14 22:17:11 dr1 Keepalived_vrrp[13314]: Interface queue is empty
Jan 14 22:17:11 dr1 Keepalived_healthcheckers[13313]: Netlink reflector reports IP fe80::20c:29ff:feca:3a0b added
Jan 14 22:17:11 dr1 Keepalived_healthcheckers[13313]: Registering Kernel netlink reflector
Jan 14 22:17:11 dr1 Keepalived_healthcheckers[13313]: Registering Kernel netlink command channel
Jan 14 22:17:11 dr1 Keepalived_healthcheckers[13313]: Opening file '/etc/keepalived/keepalived.conf'.
Jan 14 22:17:11 dr1 Keepalived_vrrp[13314]: Netlink reflector reports IP 172.16.10.10 added
Jan 14 22:17:11 dr1 Keepalived_vrrp[13314]: Netlink reflector reports IP fe80::20c:29ff:feca:3a0b added
Jan 14 22:17:11 dr1 Keepalived_vrrp[13314]: Registering Kernel netlink reflector
Jan 14 22:17:11 dr1 Keepalived_vrrp[13314]: Registering Kernel netlink command channel
Jan 14 22:17:11 dr1 Keepalived_vrrp[13314]: Registering gratuitous ARP shared channel
Jan 14 22:17:11 dr1 Keepalived_healthcheckers[13313]: Configuration is using : 9696 Bytes
Jan 14 22:17:11 dr1 Keepalived_vrrp[13314]: Opening file '/etc/keepalived/keepalived.conf'.
Jan 14 22:17:11 dr1 Keepalived_vrrp[13314]: Configuration is using : 37189 Bytes
Jan 14 22:17:11 dr1 Keepalived_vrrp[13314]: Using LinkWatch kernel netlink reflector...
Jan 14 22:17:11 dr1 Keepalived_healthcheckers[13313]: Using LinkWatch kernel netlink reflector...
Jan 14 22:17:11 dr1 Keepalived_vrrp[13314]: VRRP sockpool: [ifindex(2), proto(112), fd(11,12)]
Jan 14 22:17:12 dr1 Keepalived_vrrp[13314]: VRRP_Instance(VI_1) Transition to MASTER STATE
Jan 14 22:17:13 dr1 Keepalived_vrrp[13314]: VRRP_Instance(VI_1) Received lower prio advert, forcing new election
Jan 14 22:17:14 dr1 Keepalived_vrrp[13314]: VRRP_Instance(VI_1) Received lower prio advert, forcing new election
Jan 14 22:17:15 dr1 Keepalived_vrrp[13314]: VRRP_Instance(VI_1) Received lower prio advert, forcing new election
Jan 14 22:17:16 dr1 Keepalived_vrrp[13314]: VRRP_Instance(VI_1) Received lower prio advert, forcing new election
Jan 14 22:17:17 dr1 Keepalived_vrrp[13314]: VRRP_Instance(VI_1) Entering MASTER STATE
Jan 14 22:17:17 dr1 Keepalived_vrrp[13314]: VRRP_Instance(VI_1) setting protocol VIPs.
Jan 14 22:17:17 dr1 Keepalived_vrrp[13314]: VRRP_Instance(VI_1) Sending gratuitous ARPs on eth2 for 172.16.10.8
Jan 14 22:17:17 dr1 Keepalived_healthcheckers[13313]: Netlink reflector reports IP 172.16.10.8 added
Jan 14 22:17:17 dr1 avahi-daemon[1321]: Registering new address record for 172.16.10.8 on eth2.IPv4.
Jan 14 22:17:17 dr1 Keepalived_vrrp[13314]: VRRP_Instance(VI_1) Received lower prio advert, forcing new election
Jan 14 22:17:17 dr1 Keepalived_vrrp[13314]: VRRP_Instance(VI_1) Sending gratuitous ARPs on eth2 for 172.16.10.8
问题:
为什么只有第一个REAL SERVER被添加到列表中,另一台确没有被添加成功!
请前辈们给看一下是怎么回事。
谢谢啦 |
|