Laravel Predis Error while reading line from the server.
生活随笔
收集整理的這篇文章主要介紹了
Laravel Predis Error while reading line from the server.
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
問題
Laravel說明文檔中的 Redis 發(fā)布與訂閱案例,命令行運行php artisan redis:subscribe 到60s自動斷開并報錯
[Predis\Connection\ConnectionException]Error while reading line from the server. [tcp://127.0.0.1:6379]
解決
在config/database.php配置文件中,找到redis配置項,添加一行如下
'redis' => ['cluster' => false,'default' => ['host' => env('REDIS_HOST', '127.0.0.1'),'password' => env('REDIS_PASSWORD', null),'port' => env('REDIS_PORT', 6379),'database' => 0,'read_write_timeout' => 0,//new],]
?
原因
據(jù)Predis作者在配置文件中說明,因為在底層網(wǎng)絡(luò)資源上執(zhí)行讀取或?qū)懭氩僮鲿r使用了超時,默認(rèn)設(shè)置了timeout 為60s。
參考
https://github.com/nrk/predis/wiki/Connection-Parameters
轉(zhuǎn)載于:https://www.cnblogs.com/canyuexiang/p/6240002.html
總結(jié)
以上是生活随笔為你收集整理的Laravel Predis Error while reading line from the server.的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。