[RabbitMQ] RabbitMQ Cluster ConnectionClose Error with HAProxy
2016-03-28 13:56
477 查看
I setup the rabbitmq clustering according to the official doc and queue mirroring according to this article. Then I configure a HAProxy in front of the rabbitmq cluster.
![](https://img-blog.csdn.net/20160328134726249)
In short, on a Linux machine, tcp_keepalive is sent every 7200 seconds.
By default, HAProxy has a timeout set to 1m.
So if your queue is idle for more than 1m, HAProxy will force to drop the connection.
To fix it, increase the HAProxy timeout value to
Problem
My own script usingpikastarts fine and is able to connect to the HAProxy and consume the messages in the queue. But it will report the following error every 2 mins or so and cause my client to completely disconnected from HAProxy.
Solution
After googling for hours, this article solves my problem.In short, on a Linux machine, tcp_keepalive is sent every 7200 seconds.
$ cat /proc/sys/net/ipv4/tcp_keepalive_time 7200
By default, HAProxy has a timeout set to 1m.
defaults timeout client 1m timeout server 1m
So if your queue is idle for more than 1m, HAProxy will force to drop the connection.
To fix it, increase the HAProxy timeout value to
3hin your rabbitmq listener.
listen rabbitmq timeout client 3h timeout server 3h
相关文章推荐
- 浮动兼容问题
- LINUX 计划书 By Wenxin.Z
- 系统真机测试时出现 could not find developer disk image问题
- PHP面向对象——clone关键字
- [Tomcat] Tomcat的classloader
- HDU 4799 LIKE vs CANDLE 树形dp
- Python读大数据txt
- windows caffe 跑自己的数据遇到的问题
- 数据库Sharding的基本思想和切分策略
- 数据库Sharding的基本思想和切分策略
- UIView扩展--方便控件的布局
- 67.iOS严谨单例写法/可继承单例
- extjs入门
- C# 键值对的类型
- Java查找算法——二分查找
- android 中对图片尺度压缩和质量压缩
- 最近写的小程序
- QT学习之路————常用控件、常用操作(持续更新中。。。)
- 个人喜欢的关于模式识别、机器学习、推荐系统、图像特征、数值计算、目标跟踪等方面个人主页及博客
- 收集一些国外学习相关网站