Install and use the haproxy Server Load balancer proxy service

Source: Internet
Author: User
Tags haproxy

About haproxy

Provides high availability, Server Load balancer, and proxy Based on TCP and HTTP applications, and supports Virtual Hosts. It is a free, fast, and reliable solution. Haproxy is especially suitable for websites with extremely high loads, which usually require session persistence or layer-7 processing. Haproxy runs on the current hardware and supports tens of thousands of concurrent connections. In addition, its running mode enables it to be easily and securely integrated into your current architecture, while protecting your web servers from being exposed to the network.

Haproxy Installation

Source code compilation and installation methods

Tar zxvf haproxy-1.4.8.tar.gz

CD haproxy-1.4.8

Make target = linux26 prefix =/usr/local/haproxy

Make install prefix =/usr/local/haproxy

If it is a centos liunx server, you can directly use Yum to install

Yum install haproxy

Haproxy Configuration

After haproxy is installed, modify the configuration file to manage the proxy

VI/etc/haproxy. cfg

global        log 127.0.0.1  local3 notice        ulimit-n 40960        maxconn 10240        user haproxy        group haproxy        nbproc  4        daemon        quiet defaults        log     global        mode    http        option tcplog listen my_80         bind 0.0.0.0:80         balance roundrobin         mode   tcp         option tcpka         server test 192.168.1.2:80  listen my_82         bind 0.0.0.0:82         balance roundrobin         mode   tcp         option tcpka         server test 192.168.1.2:80

The above configuration file means to proxy port 80 and port 82 of the Local Machine to port 80 of the 192.168.1.2 server,

Access the port of machine B by accessing the port of machine.

Haproxy precautions

Some problems have not been explained. When the number of connections of the haproxy proxy exceeds 10000, the efficiency is obviously low and it is difficult to create a connection,

Therefore, in general large concurrent requests, try to use LVS or your own request distributor. haproxy can only be applied to small-scale requests and toy applications,

Its advantage is that it is simple and convenient to respond to the stress of applications with small requests and non-persistent connections.

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.