How to intall and configure Haproxy on Centos

來源:互聯網
上載者:User

標籤:

  1. Install Haproxy 
    CentOS/RHEL 5 , 32 bit:
    # rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm 
    CentOS/RHEL 5 , 64 bit:
    # rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm 
    CentOS/RHEL 6 , 32 bit:
    # rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm 
    CentOS/RHEL 6 , 64 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        log 127.0.0.1   local0        log 127.0.0.1   local1 debug        maxconn   45000 # Total Max Connections.        daemon        nbproc      1 # Number of processing cores. defaults        log     global        mode    http        option  httplog        option  dontlognull        retries 3        option redispatch        maxconn 20000        timeout server 86400000        timeout connect 86400000        timeout client 86400000        timeout queue   1000s        # [HTTP Site Configuration]listen  http_web 192.168.10.10:80        mode http        balance roundrobin  # Load Balancing algorithm        option httpchk        option forwardfor        server server1 192.168.10.100:80 weight 1 maxconn 512 check        server server2 192.168.10.101:80 weight 1 maxconn 512 check# [HTTPS Site Configuration]listen  https_web 192.168.10.10:443        mode tcp        balance source# Load Balancing algorithm        reqadd X-Forwarded-Proto:\ http        server server1 192.168.10.100:443 weight 1 maxconn 512 check        server server2 192.168.10.101:443 weight 1 maxconn 512 check # [Change HAProxy Stats URL]listen  stats   192.168.10.10:1936        mode            http        log             global        balance roundrobin        maxconn 10        clitimeout      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 Code開啟防火牆 1936 連接埠
  3. 重啟相關服務
    service iptables restart 
    service haproxy restart
    chkconfig haproxy on
  4. 後台查看網站:
    http://192.168.10.10:1936/ha-stats  or  http://192.168.10.10:1936/stats
  5. 參考連結:
    http://tecadmin.net/install-and-configure-haproxy-on-centos/

How to intall and configure Haproxy on Centos

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.