Haproxy implementing MySQL Cluster load Balancing

Source: Internet
Author: User
Tags haproxy

1. Installation

# yum Install Haproxy

2. Modify the configuration

# vim/etc/haproxy/haproxy.cfg

Configured as follows

global         daemon          nbproc 1         pidfile /var/run/ haproxy.piddefaults         mode tcp            #默认的模式mode  { tcp|http|health },tcp is 4 layer, HTTP is 7 layer, health will only return OK          retries 3            #两次连接失败就认为是服务器不可用, you can also set          option by the rear  redispatch       #当serverId对应的服务器挂掉后, force directed to other healthy servers           option abortonclose      #当服务器负载很高的时候, Automatically end the current queue processing longer links          maxconn 4096          #默认的最大连接数          timeout connect 5000ms    #连接超时           timeout client 30000ms    #客户端超时           timeout server 30000ms    #服务器超时           timeout check 2000     #= Heartbeat Detection Timeout          log globallisten mysql_cluster     bind 10.10.91.71:3306    mode tcp     Maxconn 4086    server node2 10.10.91.72:3306    server  node3 10.10.91.75:3306


3. Start

#/etc/init.d/haproxy Start


4. View status

#/etc/init.d/haproxy Status

Points to note:

1, Port 3306 can not be occupied, if the machine has MySQL, the service must be closed.

2,/var/run/haproxy.pid directory permissions to enough, if there is haproxy.pid before the first boot must be deleted.

3, other errors please refer to the blog http://blog.csdn.net/aa168b/article/details/50372649

Haproxy does not need to write the MySQL health test, the software itself can detect the MySQL service stopped, and then switch to the normal server, and when the MySQL server restarts, the Haproxy does not need to restart, but also can identify and switch up.



Haproxy implementing MySQL Cluster load Balancing

Related Article

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.