mongodb三实例集群,端口:64538
真实ip:10.105.183.207 ,206,205 虚拟ip:10.105.183.100
[root@mongodb-01 /etc/keepalived]# cat keepalived.conf
! Configuration File for keepalived
global_defs {
router_id m205 # 自身id,不要与小组其他成员重复
}
vrrp_instance VI_1 {
state BACKUP
interface eth0
virtual_router_id 80 ##vrrp小组id
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
10.105.183.100
}
}
virtual_server 10.105.183.100 64538 {
delay_loop 6
lb_algo rr
lb_kind NAT
persistence_timeout 0
protocol TCP
real_server 10.105.183.207 64538 {
weight 1
HTTP_CHECK {
connect_timeout 3
i nb_get_retry 3
delay_before_retry 3
connect_port 64538
}
real_server 10.105.183.206 64538 {
weight 1
HTTP_CHECK {
connect_timeout 3
i nb_get_retry 3
delay_before_retry 3
connect_port 64538
}
real_server 10.105.183.205 64538 {
weight 1
HTTP_CHECK {
connect_timeout 3
i nb_get_retry 3
delay_before_retry 3
connect_port 64538
}
}
}
}
}