How to Intall and configure Haproxy on Centos

Source: Internet
Author: User
Tags haproxy

  1. Install Haproxy
    Centos/rhel 5, bit:
    # RPM-UVH http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
    Centos/rhel 5, bit:
    # RPM-UVH http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
    Centos/rhel 6, bit:
    # RPM-UVH http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
    Centos/rhel 6, bit:
    # RPM-UVH http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
    Yum-y Install Haproxy
  2. Configure Haproxy
    Vi/etc/haproxy/haproxy.cfg
    Global Log127.0.0.1local0 Log127.0.0.1local1 Debug Maxconn45000# Total Max Connections. Daemon Nbproc1# Number of processing cores. Defaults log global mode HTTP option httplog option Dontlognull Retries3option Redispatch maxconn20000Timeout Server86400000Timeout Connect86400000Timeout Client86400000Timeout Queue 1000s # [HTTP Site configuration]listen http_web192.168.10.10: themode http Balance roundrobin # Load balancing algorithm option HTTPCHK option forwardfor Server Server1192.168.10.100: theWeight1Maxconn +Check server Server2192.168.10.101: theWeight1Maxconn +check# [HTTPS Site configuration]listen https_web192.168.10.10:443mode TCP balance source# Load balancing algorithm Reqadd X-forwarded-proto:\ http Server Server1192.168.10.100:443Weight1Maxconn +Check server Server2192.168.10.101:443Weight1Maxconn +Check # [change HAProxy Stats url]listen Stats192.168.10.10:1936mode HTTP log global balance Roundrobin maxconnTenclitimeout 100s srvtimeout 100s contimeout 100s Timeout queue 100s Stats Enable stats Hide-version Stats refresh 30s stats show-node Stats Realm haproxy\ Statistics stats auth admin:password stats URI/ha-stats or stats URI/stats
    haproxy.cfg CodeOpen firewall 1936 Port
  3. Restart related services
    Service Iptables Restart
    Service Haproxy Restart
    Chkconfig Haproxy on
  4. Backstage View site:
    Http://192.168.10.10:1936/ha-stats or Http://192.168.10.10:1936/stats
  5. Reference Links:
    http://tecadmin.net/install-and-configure-haproxy-on-centos/

How to Intall and configure Haproxy on Centos

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.