Haproxy+heartbeat Two scenarios (note, standby server VIP, Normal Haproxy startup method)

Source: Internet
Author: User
Tags haproxy

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.