RabbitMQ+HAProxy

原本打算直接用nginx反向代理,发现不好用,默认不支持长连接,见很多推荐HAProxy的,就试试吧~

wget http://haproxy.1wt.eu/download/1.4/src/haproxy-1.4.21.tar.gz
tar -zxvf haproxy-1.4.21.tar.gz 
cd haproxy-1.4.21
make TARGET=linux26 PREFIX=/usr/local
make install PREFIX=/usr/local
cp haproxy-1.4.21/examples/haproxy.cfg /etc/haproxy.cfg
vim /etc/haproxy.cfg 修改配置文件:

global
        log 127.0.0.1  alert debug
        #log loghost    local0 info
        maxconn 4096
        #chroot /usr/share/haproxy
        uid 99
        gid 99
        daemon
        #debug
        #quiet

defaults
        log     global
        mode    http
        option  dontlognull
        retries 3
        option  redispatch
        maxconn 2000
        contimeout      5000
        clitimeout      50000
        srvtimeout      50000

listen  rabbitmq 0.0.0.0:56720
        mode    tcp
        balance roundrobin
        option  tcpka
        server  rabbit1 192.168.1.93:5672 check inter 5000 downinter 500
        server  rabbit2 192.168.1.94:5672 check inter 5000 

用当前机器56720端口,代理93、94两台rabbit机器的5672端口。

守护模式运行:

haproxy -f /etc/haproxy.cfg -D

BTW:尚未详细测试和调优等。

----------------------------------------------我是分割线---------------------------------------------------

参考资料:

http://haproxy.1wt.eu/

http://blog.chenlb.com/2009/06/install-haproxy-and-configure-load-balance.html

http://www.joshdevins.net/2010/04/16/rabbitmq-ha-testing-with-haproxy/

http://blog.chinaunix.net/uid-10249062-id-163273.html


评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值