HAProxy

来源:互联网 发布:趣头条软件 编辑:程序博客网 时间:2024/09/15 12:19

rhel6.4以后rpm中有自带

[root@test~]# vim /etc/udev/rules.d/70-persistent-net.rules

[root@80Packages]# yum install haproxy-1.4.24-2.el6.i686.rpm -y

[root@80Packages]# rpm -ql haproxy

[root@80Packages]# man haproxy

[root@80~]# cp /etc/haproxy/haproxy.cfg /etc/haproxy/haproxy.cfg.bak

[root@80~]# vim /etc/sysconfig/rsyslog

SYSLOGD_OPTIONS="-c2 -r"

[root@80~]# vim /etc/rsyslog.conf

local2.* /var/log/haproxy.log

[root@80~]# service rsyslog restart

 

[root@80~]# vim /etc/haproxy/haproxy.cfg

在第59行:.,$d删除当前行到尾

[root@80~]# vim /etc/haproxy/haproxy.cfg

 option redispatch

 retries 3

 timeout http-request 10s

 timeout queue 1m

 timeout connect 10s

 timeout client 1m

 timeout server 1m

 timeout http-keep-alive 10s

 timeout check 10s

 maxconn 3000

 

listenstats

 mode http

 bind 0.0.0.0:1080

 stats enable

 stats hide-version

 stats uri /haproxyadmin?stats

 stats realm Haproxy\ Statistics

 stats auth admin:admin

 stats admin if TRUE

frontendweb

 bind *:80

 log global

 option httpclose

 option logasap

 option dontlognull

 capture request header Host len 20

 capture request header Referer len 60

 default_backend servers

backendservers

 balance roundrobin

 server web1 192.168.19.248:80 check maxconn 4000

 server web2 192.168.19.249:80 check maxconn 3000

 

[root@80 ~]# haproxyc

[root@80~]# service haproxy start

[root@80 ~]# netstatntlp

[root@80 ~]# psauxf

0 0
原创粉丝点击