php 致命错误:未捕获的异常“RedisException”,消息为“Redis 服务器消失”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24985156/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Fatal error: Uncaught exception 'RedisException' with message 'Redis server went away'
提问by Dipak G.
One of my application suddenly started to give error:
我的一个应用程序突然开始出错:
Fatal error: Uncaught exception 'RedisException' with message 'Redis server went away' in /var/www/_slim/_core/system/generator.001.php:133 Stack trace: #0 /var/www/_slim/_core/system/generator.001.php(133): Redis->auth('77B1BFFBC0378DF...') #1 /var/www/_slim/_core/system/generator.007.php(144): Generator001->r6_redis_start('R') #2 /var/www/_slim/_core/system/generator.007.php(26): Generator007->HarvestRedis() #3 /var/www/_slim/_core/system/generator.shopping.php(14): Generator007->Generator007() #4 /var/www/_slim/_core/system/generator.last.php(43): Generator008->Generator008() #5 /var/www/_slim/site/home/php/index.php(16): GeneratorLast->GeneratorLast() #6 /var/www/index.php(96): Gui->Gui()
#7 {main} thrown in /var/www/_slim/_core/system/generator.001.php on line 133
I have reinstalled redis-server
but no luck so far. Any suggestions?
我已经重新安装,redis-server
但到目前为止还没有运气。有什么建议?
采纳答案by Michael Arenzon
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.
好吧,正如异常所描述的那样,您的 Redis 服务器已关闭。尝试以下内容: 1. 查看运行 Redis 实例的服务器是否包含防火墙(可能是 iptables?) 2. 转到您的 Web 服务器(运行您的 php)并尝试 telnet 到您的 redis 服务器 3. 参见如果配置的主机/IP 正确。也许 Redis 服务器的网络设置中的某些内容已更改。
回答by Okneloper
Maybe not the answer to the specific question, but might help those new to Redis who come here by googling the Exception.
也许不是特定问题的答案,但可能会帮助那些通过谷歌搜索异常来这里的 Redis 新手。
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 实例并开始在其上调用方法,而没有先通过调用连接到 Redis 服务器,您也会收到此异常
$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.
如果 Redis 不是本地主机、配置为侦听不同的端口、设置密码等,显然应该调整调用的参数。
回答by Багдаулет Сайын
I had a problem connecting to the redis
我在连接到 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);
回答by Bartho Bernsmann
If you are running on a local/dev environment, make sure that Redis Service is running.
如果您在本地/开发环境中运行,请确保 Redis 服务正在运行。
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.
您可以通过打开 Redis 客户端 cmd 来检查您的本地服务是否正在运行。如果您使用的是 MAC,请打开命令行并输入 redis-cli。
If your server is running you should see:
如果您的服务器正在运行,您应该看到:
redis 127.0.0.1:6379>
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.
就我而言,我忘记启动 Windows 服务,所以我要做的就是:打开 services.msc,启动 Redis Server 服务。