情况是酱紫滴
线上有一个rabbitmq 集群,一台磁盘模式的 两台内存模式的. 使用erlang 做cookie 做同步.haproxy做负载
在连接一会后 程序抛出异常 Consumer raised exception, processing can restart if the connection factory
原因是因为ha 在做负载的时候 设置玩tcp连接后 还需要把默认的 timeout server 和 timeout client 注释掉.
这样ha就不会自动的关闭mq的tcp 长连接了
华丽的分割线_____________________________________________________________________
global
log 127.0.0.1 local3
maxconn 65535 #这里可以改大一些 增加扩容
chroot /usr/local/haproxy
uid nobody
gid nobody
daemon
nbproc 1
pidfile /usr/local/haproxy/haproxy.pid
#debug
#tune.ssl.default-dh-param 2048
defaults
log 127.0.0.1 local3
#mode tcp
option tcplog
#option http-server-close
option dontlognull
option forwardfor
option redispatch
retries 2
maxconn 3000 #这里可以改大一些 增加扩容
timeout connect 5000
#timeout client 100000 将此行注释
#timeout server 100000 将此行注释
listen web_ha
bind 0.0.0.0:9999
mode http
transparent
stats refresh 30s
stats uri /haproxy-stats
stats hide-version
stats realm Haproxy\statistics
stats auth ********:*********
listen rabbitmq_cluster 0.0.0.0:5670
mode tcp
option tcplog
option tcpka #允许发送tcp 长连接
log global
balance roundrobin
#cookie rabbit insert indirect nocache
#server rabbitmq-1 192.168.8.114:5672 weight 2 check inter 2000 rise 1 fall 5
server rabbitmq-2 192.168.8.115:5672 check inter 5000
server rabbitmq-3 192.168.8.116:5672 check inter 5000
______________________________________________________________________________
感谢 http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/2013-January/024858.html