Fatal error: Uncaught exception 'RedisException' with message 'Redis server went away'

空扰寡人 提交于 2019-12-05 20:13:56

Well, as the exception describes itself, your Redis server is down. Try the following stuff: 1. See if the server that runs the Redis instance contains any firewall on (iptables, maybe?) 2. Go to your web server (that runs your php) and try to telnet to your redis server 3. See if the configured host/ip is correct. Maybe something in the network settings of the Redis server have been changed.

Maybe not the answer to the specific question, but might help those new to Redis who come here by googling the Exception.

You will also get this exception if you create a Redis instance and start to call methods on it without first connecting to a Redis server by calling

$redis->connect('localhost')

The arguments for the call should obviously be adjusted if Redis is not a local host, configured to listen on a different port, set up a password etc.

If you are running on a local/dev environment, make sure that Redis Service is running.

You can check if your local service is running by opening the Redis Client cmd. If you are on a MAC open the command line and type redis-cli.

If your server is running you should see:

redis 127.0.0.1:6379>

In my case I forgot to start the windows service so all I had to do was to: open services.msc, start Redis Server service.

I had a problem connecting to the redis

I managed to solve it by changing the colon to a comma

$redis->connect('localhost:6379');

from this to this

$redis->connect('localhost', 6379);
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!