Not yet familiar with the Linux system installation Haproxy record!

Source: Internet
Author: User
Tags haproxy

Recently the company's IIS server is always down, their knowledge of operation and maintenance is very short, listen to some of the introduction decided to bite the bullet, set up a haproxy load to the back end of two IIS. Here's a summary of experience!

First install haproxy with yum command This is very simple, say the process! Install the GCC compiler first

# yum Install gcc
# wget http://haproxy.1wt.eu/download/1.4/src/haproxy-1.4.24.tar.gz
# tar ZXVF haproxy-1.4.24
# make Install
# mkdir-p/usr/local/haproxy/etc
# mkdir-p/usr/local/haproxy/sbin
# CP Examples/haproxy.cfg/usr/local/haproxy/etc
# ln-s/usr/local/sbin/haproxy/usr/local/haproxy/sbin/haproxy

To install the steps here are basically completed, the following start to make configuration file modification, found on the Internet a lot of files to try unsuccessfully, finally found a blog post with an ACL configuration success, and do not understand the specific meaning. Let's do it with your own understanding!

global        log 127.0.0.1    local0        log 127.0.0.1    local1 notice         #log  loghost     local0 info                 maxconn 50000     #最大连接5W不知道针对什么设备而言          chroot /usr/share/haproxy        uid 99         gid 99        daemon          #debug          #quiet 
defaults        log     global         mode    http         option  httplog        option  redispatch         option  abortonclose         retries 3        maxconn 50000     #最大连接10W不知道针对什么设备而言         contimeout       5000        clitimeout       50000        srvtimeout      50000  frontend web_site        bind 0.0.0.0:80         mode http        log global         maxconn 100000        option httplog         option httpclose         option forwardfor        acl web1 hdr_reg ( Host)  -i ^ (gq.wdmmo.com) #gq域名主机头赋值给WEB1         acl web2  hdr_reg (host)  -i ^ (passport.wdmmo.com)         acl  web3 hdr_reg (host)  -i ^ (pay.wdmmo.com)         acl  web4 hdr_reg (host)  -i ^ (op.wdmmo.com)         acl  web5 hdr_reg (host)  -i ^ (yx.wdmmo.com)         use_ Backend web1_ser if web1   #WEB1使用后端服务器WEB1_SER         use_backend  web2_ser if web2        use_backend web3_ser  if web3        use_backend web4_ser if web4         use_backend WEB5_SER if WEB5         default_backend web_serverbackend WEB1_SER         mode http        balance roundrobin     #轮询负载, the same amount of load on each server         cookie SERVERID  insert nocache indirect        server server1  192.168.10.53:80 cookie 11 check inter 1500 rise 3 fall 3  Weight 1            #gq一个服务器真是内网地址, parameter function unknown          server server2 192.168.10.131:80 cookie 11 check inter 1500 rise  3 fall 3 weight 1                                             backend web2_ser         mode http         balance roundrobin        cookie serverid insert  Nocache indirect        server server1 192.168.10.53:80  cookie 11 check inter 1500 rise 3 fall 3 weight 1     &nBsp;   server server2 192.168.10.131:80 cookie 11 check inter  1500 rise 3 fall 3 weight 1backend WEB3_SER         mode http        balance roundrobin         cookie serverid insert nocache indirect         server server1 192.168.10.53:80 cookie 11  check inter 1500 rise 3 fall 3 weight 1         server server2 192.168.10.131:80 cookie 11 check inter  1500 rise 3 fall 3 weight 1backend WEB4_SER         mode http        balance roundrobin         cookie serverid insert nocache indirect         server server1 192.168.10.53:80 cookie 11 check inter  1500 rise 3 fall 3 weight 1         server server2 192.168.10.131:80 cookie 11 check inter 1500 rise  3 fall 3 weight 1                                                               backend WEB5_SER         mode http        balance  roundrobin        cookie serverid insert nocache indirect         server server1 192.168.10.53:80 cookie 11 check  inter 1500 rise 3 fall 3 weight 1         server server2 192.168.10.131:80 cookie 11 check inter 1500 rise  3 fall 3 weight 1                                                            backend web_server         mode http        balance roundrobin         cookie serverid insert nocache indirect         server server1 192.168.10.53:80 cookie 11 check inter  1500 rise 3 fall 3 weight 1         server server2 192.168.10.131:80 cookie 11 check inter 1500 rise  3 fall 3 weight 1                                                  listen  admin_stats        bind 192.168.10.57:1080         mode http         Maxconn 10        stats uri /stats         Stats auth wd1023:wd!023        stats hide-version

This article from the "Color" blog, declined reprint!

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.