应用程序模块订阅redis运行一段时间出现一直重连Redis服务,日志如下:
[2015-12-24 08:30:17,307] ERROR listener.RedisMessageListenerContainer: Connection failure occurred. Restarting subscription task after 5000 ms
[2015-12-24 08:31:40,530] ERROR listener.RedisMessageListenerContainer: Connection failure occurred. Restarting subscription task after 5000 ms
[2015-12-24 08:33:16,460] ERROR listener.RedisMessageListenerContainer: Connection failure occurred. Restarting subscription task after 5000 ms
[2015-12-24 08:34:36,288] ERROR listener.RedisMessageListenerContainer: Connection failure occurred. Restarting subscription task after 5000 ms
[2015-12-24 08:36:13,674] ERROR listener.RedisMessageListenerContainer: Connection failure occurred. Restarting subscription task after 5000 ms
[2015-12-24 08:37:35,796] ERROR listener.RedisMessageListenerContainer: Connection failure occurred. Restarting subscription task after 5000 ms
[2015-12-24 08:38:56,984] ERROR listener.RedisMessageListenerContainer: Connection failure occurred. Restarting subscription task after 5000 ms
[2015-12-24 08:40:40,648] ERROR listener.RedisMessageListenerContainer: Connection failure occurred. Restarting subscription task after 5000 ms
[2015-12-24 08:42:21,472] ERROR listener.RedisMessageListenerContainer: Connection failure occurred. Restarting subscription task after 5000 ms
[2015-12-24 08:43:41,462] ERROR listener.RedisMessageListenerContainer: Connection failure occurred. Restarting subscription task after 5000 ms
redis服务断开redis客户端,日志如下:
[112212] 24 Dec 06:29:40.076 # Client addr=127.0.0.1:43672 fd=8 name= age=34112 idle=1 flags=N db=2 sub=0 psub=4 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=449 omem=12588584 events=rw cmd=psubscribe scheduled to be closed ASAP for overcoming of output buffer limits.
从日志信息可以看出buffer缓存已经超出redis服务所规定的订阅缓存限制值,查看redis.conf配置文件
client-output-buffer-limit pubsub 32mb 8mb 60 # Redis订阅客户端订阅buffer超过32M或持续60秒超过8M,订阅立即被关闭!
解决改问题把限制值调大即可解决!