哪些网站做ip向小说,火车头 wordpress 4.9,网络建设与管理包括哪些方面,长沙关键词优化公司电话文章目录1. 背景2. 现象3. 原因分析4. 解决方案5. 成功案例1. 背景
线上有一个rabbitmq 集群,一台磁盘模式的 两台内存模式的. 使用erlang 做cookie 做同步.haproxy做负载
2. 现象
在连接一会后 程序抛出异常 Consumer raised exception, processing can restart if the con…
文章目录1. 背景2. 现象3. 原因分析4. 解决方案5. 成功案例1. 背景
线上有一个rabbitmq 集群,一台磁盘模式的 两台内存模式的. 使用erlang 做cookie 做同步.haproxy做负载
2. 现象
在连接一会后 程序抛出异常 Consumer raised exception, processing can restart if the connection factory
3. 原因分析
原因是因为ha 在做负载的时候 设置玩tcp连接后 还需要把默认的 timeout server 和 timeout client 注释掉.这样ha就不会自动的关闭mq的tcp 长连接了
4. 解决方案
华丽的分割线_____________________________________________________________________
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
5. 成功案例
#logging options
globallog 127.0.0.1 local0 info #日志输出配置,所有日志都记录在本机,通过local0输出maxconn 5120chroot /app/haproxy #haproxy 安装路径uid 99 #所属运行的用户uidgid 99 #所属运行的用户组daemon #后台运行quietnbproc 20pidfile /var/run/haproxy.pid #指定PID文件路径defaultslog global#使用4层代理模式mode http为7层代理模式mode tcp#if you set mode to tcp,then you nust change tcplog into httplogoption tcplogoption dontlognullretries 3option redispatchmaxconn 2000#连接超时时间timeout connect 5s#客户端空闲超时时间为 60秒 则HA 发起重连机制#timeout client 60s#服务器端连接超时时间为 15秒 则HA 发起重连机制#timeout server 15s#front-end IP for consumers and producters
listen rabbitmq_clusterbind 0.0.0.0:5672 #绑定协议端口#配置TCP模式#所处理的类别,默认采用http模式,可配置成tcp作4层消息转发mode tcpoption tcpka #简单的轮询balance roundrobin#负载均衡策略#rabbitmq集群节点配置 #inter 每隔五秒对mq集群做健康检查 2次正确证明服务器可用2次失败证明服务器不可用并且配置主备机制server mq-001 192.168.52.146:5672 check inter 5000 rise 2 fall 2server mq-002 192.168.52.147:5672 check inter 5000 rise 2 fall 2server mq-003 192.168.52.148:5672 check inter 5000 rise 2 fall 2
#配置haproxy web监控查看统计信息
listen statsbind 192.168.52.145:8100 #前端浏览器中查看统计的WEB界面地址mode httpoption httplog #日志类别,采用httplogstats enablestats auth admin #设置查看统计的账号密码stats admin if { always_true }stats hide-version #隐藏统计页面的HAproxy版本信息#设置haproxy监控地址为http://localhost:8100/rabbitmq-statsstats uri /rabbitmq-statsstats refresh 5s #5s刷新一次