install_haproxy

简介:

安装haproxy

yum install -y haproxy

chkconfig haproxy on

vim /etc/sysconfig/rsyslog 

SYSLOGD_OPTIONS="-c 2 -r"

vim /etc/rsyslog.conf 

local2.*                                                /var/log/haproxy.log

service rsyslog restart

service rsyslog start


vim /etc/haproxy/haproxy.cfg

global

    log         127.0.0.1 local2

    chroot      /var/lib/haproxy

    pidfile     /var/run/haproxy.pid

    maxconn     4000

    user        haproxy

    group       haproxy

    daemon

defaults

    mode                    http

    log                     global

    option                  httplog

    option                  dontlognull

    option http-server-close

    option forwardfor       except 127.0.0.0/8

    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


listen stats

    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

frontend http-in

    bind *:80

    mode http

    log global

    option httpclose

    option logasap

    option dontlognull

    capture request  header Host len 20

    capture request  header Referer len 60

    default_backend servers

frontend healthcheck

    bind :1099

    mode http

    option httpclose

    option forwardfor

    default_backend servers

backend servers

    balance roundrobin

    server websrv1 192.168.100.161:80 check maxconn 2000

    server websrv2 192.168.100.162:80 check maxconn 2000 


注意:访问haproxy的状态地址为http://ip:1080/haproxyadmin?stats




 本文转自1321385590 51CTO博客,原文链接:http://blog.51cto.com/linux10000/1717540,如需转载请自行联系原作者






相关文章
|
应用服务中间件 数据安全/隐私保护 nginx
Haproxy-安装与配置
安装 Haproxy
88 0
|
负载均衡 Linux
HaProxy 安装
HaProxy 安装
|
应用服务中间件 nginx
|
算法 开发工具 负载均衡
|
监控 Linux 数据安全/隐私保护
|
监控 负载均衡 网络协议
|
网络协议 应用服务中间件 nginx
|
应用服务中间件 nginx 索引