Main Standby mode
Programme I
That is also where the VIP is, Haproxy is where to start the main standby mode.
[Email protected] ~]# Cat/etc/ha.d/haresources#gao services#10.0.0.103 Www.lvnian.orgMASTER ipaddr::10.0.0.103/24/ Eth0 Haproxyd [[email protected] ~]#
Note the point:
# #haproxy If you manage heartbeat, then the Haproxy script above must be/etc/init.d/directory or early/etc/ha.d/rresource.d/directory
Let different VIPs provide haproxy services on different servers. There was a problem, and another device took over.
######################################################
######################################################
######################################################
#方案二
#也就是在主和备都启动haproxy, but where is the VIP, and which side provides services.
[Email protected] ~]# Cat/etc/ha.d/haresources#gao services#10.0.0.103 www.etianetian.org #后面不接服务MASTER ipaddr: : 10.0.0.103/24/eth0 [[email protected] ~]#
#这个方案需要解决一个问题, is more VIP, in the standby server does not have VIP, for the haproxy cannot start. Kernel tuning is required at this time.
Here's how to fix it:
echo "Net.ipv4.ip_nonlocal_bind = 1" >>/etc/sysctl.confsysctl-p
#对于haproxy的多业务, just use the multi-listen tag, so that a business corresponds to a listen tag in the corresponding VIP.
This allows you to work with heartbeat to implement a dual-master architecture, so that you can load-balance the use of haproxy in the primary and standby two servers.
Such as:
VIP 10.0.0.104 =========== "Listen www vip 10.0.0.103 ===========" Listen BBS
Virtual out of two VIP through heartbeat, one server virtual out of a VIP
This article is from the "Struggle Bar" blog, please be sure to keep this source http://lvnian.blog.51cto.com/7155281/1710425
Haproxy+heartbeat Two scenarios (note, standby server VIP, Normal Haproxy startup method)