解决phpredis 'RedisException' with message 'read error on connection'
来源:互联网 发布:淘宝上好的纯银耳饰店 编辑:程序博客网 时间:2024/05/24 05:24
最近一个后台常驻job通过redis的brpop阻塞读取消息时,设置的超时时间较长
list($key,$row)=$redis->brPop($queue_name,3600); //超时时间为1小时
但是在实际的使用中发现很短时间后就会退出,通过查看error log,发现:'RedisException' with message 'read error on connection' 提示
经过一番折腾,原来发现是php.ini文件中的一个配置项导致:
default_socket_timeout = 60
由于redis扩展也是基于php 的socket方式实现,因此该参数值同样会起作用。
找到了问题就比较好解决了:
1、直接修改php.ini,将其设置为我们想要的值(这个不推荐)
2、在我们的脚本中通过以下方式设置,这样就比较灵活,不对其他脚本产生影响
ini_set('default_socket_timeout', -1); //不超时
0 0
- 解决phpredis 'RedisException' with message 'read error on connection'
- 解决'RedisException' with message 'read error on connection'
- 解决php zf2中redis调用提示'RedisException' with message 'read error on connection'
- phpredis "read error on connection" 的解决办法
- brpop read error on connection
- Fatal error: Uncaught exception 'RedisException' with message 'Redis server went away'
- Error connecting to server localhost on port 1527 with message Connection refused
- Listener refused the connection with the following error 错误解决
- Listener refused the connection with the following error 错误解决
- Listener refused the connection with the following error 错误解决
- Listener refused the connection with the following error 错误解决
- Listener refused the connection with the following error 错误解决
- Adb connection Error:EOF,error: Read-only file system"解决方
- Docker Error Message on Macbook
- "This connection is untrusted" - Firefox error message
- BSXPCMessage received error for message: Connection interrupted
- fatal: read error: Connection reset by peer
- fatal: read error: Connection reset by peer
- hdu1229——还是A+B
- Thinkphp框架中使用数据对象自动处理添加数据库数据时,关于在数据库表中添加新列时出现新列的数据添加不上去?
- memmove 和 memcpy的区别
- http、TCP/IP协议与socket之间的区别
- Swift入门———字符串
- 解决phpredis 'RedisException' with message 'read error on connection'
- hdoj 2096 小明A+B
- 数据库设计基础
- Java中的线程池(2)
- org.springframework.beans.ConversionNotSupportedException
- java中continue,return,break的区别
- 浅谈android网络编程
- Android APP第一次使用引导界面的制作
- 用JAVA实现大文件上传及显示进度信息