A high availability virtual IP (HAVIP) is a private IP address assigned from the CIDR block of a VPC subnet. It is usually used together with high-availability software, such as Keepalived and Windows Server Failover Cluster, to build a highly available primary/secondary cluster.
Note:
- HAVIP is currently in beta, and switching between primary/secondary servers may take 10 seconds. To try it out, please apply to be a beta user.
- To guarantee the CVM high availability in a primary/secondary cluster, we recommend assigning CVMs to different hosts using placement groups. For more information about the placement group, see Placement Group.
- The high availability software should support sending ARP messages.
Typically, a high availability primary/secondary cluster consists of two servers: an active primary server and a standby secondary server. The two servers share the same VIP (virtual IP). The VIP can only work on one primary server at the same time. When the primary server fails, the secondary server will take over the VIP to continue providing services.
Note:Keepalived is a VRRP-based high availability software. To use Keepalived, first complete its configuration in the
Keepalived.conf
file.
The following figure shows the HAVIP architecture.
According to the example figure, CVM1 and CVM2 can be built into a high availability primary/secondary cluster with the following steps:
Some public cloud vendors do not support binding a private IP to CVM through ARP announcement due to security reasons such as ARP spoofing. If you directly use a private IP as virtual IP in the “Keepalived.conf” file, Keepalived will not be able to update the IP to MAC mapping during the primary/secondary server virtual IP switch. In this case, you have to call an API to switch the IP.
Using Keepalived configuration as an example, the IP configurations are as follows:
vrrp_instance VI_1 {
state BACKUP #Secondary device
interface eth0 #ENI name
virtual_router_id 51
nopreempt #Non-preempt mode
#preempt_delay 10
priority 80
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
unicast_src_ip 172.17.16.7 #Private IP of the local device
unicast_peer {
172.17.16.13 #IP address of the peer device, for example: 10.0.0.1
}
virtual_ipaddress {
172.17.16.3 #Enter the HAVIP address you have applied for in the console.
}
garp_master_delay 1
garp_master_refresh 5
track_interface {
eth0
}
track_script {
checkhaproxy
}
}
If there is no HAVIP, the following section of the configuration file will be invalid.
virtual_ipaddress {
172.17.16.3 #Enter the HAVIP address you have applied for in the console.
}
Was this page helpful?