`

haproxy rabbitmq config

阅读更多

haproxy 安装

 

wget http://haproxy.1wt.eu/download/1.4/src/haproxy-1.4.25.tar.gz

tar -zxvf haproxy-1.4.25.tar.gz

chmod -R 777 haproxy-1.4.25

cd haproxy-1.4.25

make TARGET=generic

make install

 

 

haproxy 配置 rabbitmq

 

mkdir conf

cd conf

touch haproxy-rabbitmq.conf

chmod +x haproxy-rabbitmq.conf

vi haproxy-rabbitmq.conf

cd ../

 

haproxy 启动服务

 

/opt/haproxy-1.4.25/haproxy -f /opt/haproxy-1.4.25/conf/haproxy-rabbitmq.conf

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

=============== haproxy rabbitmq 配置 ========================

 

# this config needs haproxy

 

#logging options 

global 

        log 127.0.0.1 local0 info 

        maxconn 5120 

        chroot /opt/haproxy-1.4.25 

        uid 99 

        gid 99 

        daemon 

        quiet 

        nbproc  2 

        pidfile /opt/haproxy-1.4.25/haproxy.pid 

 

#load balancing defaults 

defaults 

       log        global 

       #使用4层代理模式,"mode   http"为7层代理模式 

       mode       tcp 

       #if you set mode to tcp,then you nust change tcplog into httplog 

       option     tcplog 

       option     dontlognull 

       retries    3 

       option redispatch 

       maxconn 2000 

       contimeout      5s 

       clitimeout      120s 

       srvtimeout      120s 

 

#front-end IP for consumers and producters 

listen rabbitmq_local_cluster 192.168.1.134:5670 

       #配置TCP模式 

       mode      tcp 

       #balance url_param userid 

       #balance url_param session_id check_post 64 

       #balance hdr(User-Agent) 

       #balance hdr(host) 

       #balance hdr(Host) use_domain_only 

       #balance rdp-cookie 

       #balance leastconn 

       #balance source  //ip 

       #简单的轮询 

       balance roundrobin 

       #rabbitmq集群节点配置 

       server rabbit137 192.168.1.137:5672 check inter 5000 rise 2 fall 2 

       server rabbit138 192.168.1.138:5672 check inter 5000 rise 2 fall 2

 

#配置haproxy web监控,查看统计信息 

listen private_monitoring :8100 

       mode    http 

       option  httplog 

       stats   enable 

       #设置haproxy监控地址为http://192.168.1.134:8100/rabbitmq-stats 

       stats   uri  /rabbitmq-stats 

       stats   refresh 5s 

 

0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics