CENTOS7 installation Haproxy

Source: Internet
Author: User

Installing Haproxy

#yum-y install gcc #tar zxf haproxy-1.4.21.tar.gz#mv haproxt-1.4.21 haproxy#make target=linux31 prefix=/usr/loc Al/haproxy installing Haproxy to the specified directory #make install Prefix=/usr/local/haproxy

Configuration   

#安装完后会在安装目录下生成三个目录     doc sbin  share#cd /usr/local/haproxy#vi  haproxy.cfg              #默认没有这个文件, You need to create your own global    maxconn 51200    uid 99    manually  gid 99    daemon    pidfile /usr/local/haproxy/logs/ haproxy.pid        mode http  #默认的模式mode  { tcp|http |health },tcp is level 4, HTTP is 7, and health will only return ok           #retries  2  #两次连接失败就认为是服务器不可用, 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            timeout connect 5000ms  #连接超时           timeout client  30000ms  #客户端超时           timeout server  30000ms  #服务器超时            #timeout  check 2000  #= Heartbeat Detection Timeout           log 127.0.0.1 local0  err #[err warning info debug]           balance roundrobin                       #负载均衡算法   #         option  httplog                          #日志类别, using httplog  #         option  httpclose    #每次请求完毕后主动关闭http通道, Ha-proxy does not support keep-alive, only simulation > implementation of this mode   #        option  dontlognull  #         option  forwardfor   #如果后端服务器需要获得客户端真实ip需要配置的参数, Client ip  listen admin_stats         can be obtained from Http header bind 0.0.0.0:1080  #监听端口           option  httplog  #采用http日志格式           stats refresh  30s  #统计页面自动刷新时间           stats uri /stats   #统计页面url           stats realm Haproxy  manager  #统计页面密码框上提示文本           stats auth  admin:admin  #统计页面用户名和密码设置           #stats  hide-version # Hide Haproxy version information on the statistics page Listen test2 :80       option httpclose        option forwardfor        Server s1 192.168.0.168:80 check weight 1 minconn 1 maxconn 3  check inter 40000       server s2  192.168.0.198:80 check weight 1 minconn 1 maxconn 3 check inter  40000 Start haproxy      /usr/local/haproxy/sbin/haproxy -f  Haproxy.cfg

To access Http://ip:1080/stats, the following interface appears

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/79/35/wKioL1aLiX2jAkj3AADA5ya6XJQ514.png "title=" 1.png " alt= "Wkiol1alix2jakj3aada5ya6xjq514.png"/>

Access http://ip:80 to achieve proxy effects.

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/79/36/wKioL1aLjmeAUuweAAAYe-nAnuI576.png "style=" float: none; "title=" 2.png "alt=" Wkiol1aljmeauuweaaaye-nanui576.png "/>

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/79/37/wKiom1aLjkKgMp2pAAAXQe-ErAU276.png "style=" float: none; "title=" 3.png "alt=" Wkiom1aljkkgmp2paaaxqe-erau276.png "/>


CENTOS7 installation Haproxy

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.