We currently have an alias assigned to our NIC for the purposes of managing a HA Proxy pair.
# cat /etc/sysconfig/network-scripts/ifcfg-eth0:proxy
DEVICE=eth0:proxy
BOOTPROTO=none
ONPARENT=no
TYPE=Ethernet
IPADDR=10.1.1.2
NETMASK=255.255.255.255
NM_CONTROLLED=no
This file exists on both nodes. When we want to switch which proxy is handling traffic, we do an ifdown eth0:proxy
on the current primary, and an ifup eth0:proxy
on the secondary. It's a fully manual process.
Apparently, RedHat has deprecated this way of assigning multiple IP addresses. Instead they recommend just adding the secondary IP to the main interface:
# ifcfg-eth0
...
IPADDR2=10.1.1.2
...
But there doesn't appear to be a 'nice' way to manage the process of bringing up the IP on the secondary box, and bringing it down on the primary like my example above.
We do not use NetworkManager either. That service has been stopped and disabled.
Is there a way to switch the active public address on both nodes without editing both configuration files and restarting the NIC, similar to how we were doing it before?
Also, is there a good way of automating the up/down process if, for example, the primary gets restarted? It'd be nice if the secondary could detect that the primary is gone, and automatically take over the VIP.
We don't want to have both HAProxies serving traffic at the same time by DNS load balancing, because the stickiness of backend servers is important.
0 Answers