首页 > 其他 > 详细

haproxy的配置安装

时间:2015-06-11 02:16:20      阅读:314      评论:0      收藏:0      [点我收藏+]

1、下载haproxy:
http://www.haproxy.org/


2、指定目录安装
mkdir -p /usr/local/haproxy
tar -xvf  haproxy-1.4.tar.gz
make TARGET=linux26 PREFIX=/usr/local/haproxy   #系统内核版本2.6
make install PREFIX=/usr/local/haproxy

3、调整配置文件:
(192.168.1.32:20001-192.168.1.35:20001是node节点)

cat  /etc/haproxy.cfg
global
   # log 127.0.0.1 local3 debug
    maxconn 20480
    chroot /usr/local/haproxy
    uid 0 
    gid 0
    daemon
    quiet
    nbproc 4     #提升性能关键参数
    pidfile /var/run/haproxy.pid
    spread-checks 2
    ulimit-n 82000
defaults
        log global
        timeout server  3s
        timeout connect 3s
        timeout client 30s
        timeout http-request 3s
        timeout queue 3s
        mode tcp
        balance static-rr
      # balance roundrobin
     #  balance source
        maxconn 10000
listen redis_cluster *:60001
        mode tcp
        balance  static-rr
        maxconn  10000

        option httplog
        option dontlognull
        option logasap
        option forwardfor
        option httpclose
#        option redis-check
        server tm1 192.168.1.32:20001 weight 1  maxconn 10000 check inter 1s rise 2 fall 1
        server tm2 192.168.1.33:20001 weight 1  maxconn 10000 check inter 1s rise 2 fall 1
        server tm3 192.168.1.34:20001 weight 1  maxconn 10000 check inter 1s rise 2 fall 1
        server tm4 192.168.1.35:20001 weight 1 maxconn  10000 check inter 1s rise 2 fall 1


listen  admin_status
        mode  http
        bind *:8083
        option httplog
        log global
        stats enable
        stats refresh 10s
#        stats hide-version
        stats realm Haproxy Statistics
        stats uri  /status
        stats auth  zhaogp:1234
        stats admin if TRUE

4、启动:
haproxy  -D -f /etc/haproxy.cfg  -p /var/run/haproxy.pid

5、监控:
查看状态:http://localhost:8083/status
 用户密码:zhaogp/1234
bubuko.com,布布扣

haproxy的配置安装

原文:http://blog.itpub.net/20625855/viewspace-1693421/

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!