求助:为什么我的master 和 backup 上都有vip呢?
我用的是LVS+Keepalived
keepalived设置了master和backup
但是我的master的backup都有虚拟ip 192.168.37.137,这是为什么?
另外当master宕机后web就不能访问了。
以下是我的配置
master 配置
! Configuration File for keepalived
global_defs {
notification_email {
tech@admin.com
}
notification_email_from admin@localhost
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id LVS_DEVEL
}
vrrp_instance VI_1 {
state MASTER
interface eth0
lvs_sync_daemon_inteface eth0
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.37.137
}
}
virtual_server 192.168.37.137 80 {
delay_loop 6
lb_algo rr
lb_kind DR
nat_mask 255.255.255.0
persistence_timeout 50
protocol TCP
real_server 192.168.37.135 80 {
weight 1
HTTP_GET {
url {
path /index.html
status_code 200
}
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
}
}
real_server 192.168.37.136 80 {
weight 1
HTTP_GET {
url {
path /index.html
status_code 200
}
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
}
}
}
backup 配置
! Configuration File for keepalived
global_defs {
notification_email {
tech@admin.com
}
notification_email_from admin@localhost
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id LVS_DEVEL2
}
vrrp_instance VI_1 {
state BACKUP
interface eth0
lvs_sync_daemon_inteface eth0
virtual_router_id 51
priority 80
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.37.137
}
}
virtual_server 192.168.37.137 80 {
delay_loop 6
lb_algo rr
lb_kind DR
nat_mask 255.255.255.0
persistence_timeout 50
protocol TCP
real_server 192.168.37.135 80 {
weight 1
HTTP_GET {
url {
path /index.html
status_code 200
}
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
}
}
real_server 192.168.37.136 80 {
weight 1
HTTP_GET {
url {
path /index.html
status_code 200
}
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
}
}
}
master的
1: lo: mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
2: eth0: mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:0c:29:bd:61:fa brd ff:ff:ff:ff:ff:ff
inet 192.168.37.133/24 brd 192.168.37.255 scope global eth0
inet 192.168.37.137/32 scope global eth0
backup的
1: lo: mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
2: eth0: mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:0c:29:bb:87:ca brd ff:ff:ff:ff:ff:ff
inet 192.168.37.134/24 brd 192.168.37.255 scope global eth0
inet 192.168.37.137/32 scope global eth0
missing.cn
周四, 2012-12-20 08:27
Permalink
两台机器之间通讯有问题,检查防火墙设置
两台机器上的iptalbes关闭之后再看看。