keepalived 2 VIP and 2 servers
6,047
On host 1:
vrrp_instance VI_1 {
state MASTER
interface eth0
dont_track_primary
virtual_router_id 1
priority 150
advert_int 5
mcast_src_ip 172.16.40.1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
10.0.0.1/24 dev eth0
}
}
vrrp_instance VI_2 {
state BACKUP
interface eth0
dont_track_primary
virtual_router_id 5
priority 100
advert_int 5
mcast_src_ip 172.16.40.1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
10.0.0.2/24 dev eth0
}
}
On host 2:
vrrp_instance VI_1 {
state BACKUP
interface eth0
dont_track_primary
virtual_router_id 1
priority 100
advert_int 5
mcast_src_ip 172.16.40.2
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
10.0.0.1/24 dev eth0
}
}
vrpp_instance VI_2 {
state MASTER
interface eth0
dont_track_primary
virtual_router_id 5
priority 150
advert_int 5
mcast_src_ip 172.16.40.2
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
10.0.0.2/24 dev eth0
}
}
For the no-auto-failback, look at nopreempt in the keepalived.conf man page but also see: http://article.gmane.org/gmane.linux.keepalived.devel/1537%22
Related videos on Youtube
Comments
-
Denis almost 2 years
Is it possible to configure keepalived in such a way?
In normal state VIP_1 assigned to SERVER_1 and VIP_2 assigned to SERVER_2
On server failure all VIP's going to working server, and after failed server becomes live we don't migrate his VIP back to him, we need to do it manual due to some content-replication reasons.
configuration at the moment:
#SERVER_1 vrrp_sync_group VG1 { group { content } } vrrp_instance content { state BACKUP interface eth1 virtual_router_id 1 priority 100 advert_int 1 authentication { auth_type PASS auth_pass 1212 } virtual_ipaddress { 192.168.100.111/24 } } # SERVER_2 vrrp_sync_group VG1 { group { content } } vrrp_instance content { state BACKUP interface eth1 virtual_router_id 1 priority 100 advert_int 1 authentication { auth_type PASS auth_pass 1212 } virtual_ipaddress { 192.168.100.111/24 } }
-
Denis over 11 yearserrm, can't correct IPs instead of
blah blah blah
sections in your answer, always get 2 IPs on same server. can you make more detailed configuration?