简体   繁体   English

致命错误:未捕获的异常“RedisException”和消息“Redis 服务器已消失”

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

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.我已经重新安装了redis-server但到目前为止还没有运气。 Any suggestions?有什么建议么?

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实例并开始在其上调用方法而不首先通过调用连接到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不是本地主机,配置为侦听其他端口,设置密码等,则显然应调整该调用的参数。

Well, as the exception describes itself, your Redis server is down. 好吧,正如异常所描述的那样,您的Redis服务器已关闭。 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. 尝试以下内容:1。查看运行Redis实例的服务器是否包含任何防火墙(iptables,也许?)2。转到您的Web服务器(运行您的php)并尝试telnet到您的redis服务器3.参见如果配置的主机/ IP是正确的。 Maybe something in the network settings of the Redis server have been changed. 也许Redis服务器的网络设置中的某些内容已被更改。

If you are running on a local/dev environment, make sure that Redis Service is running. 如果您在本地/ dev环境中运行,请确保Redis服务正在运行。

You can check if your local service is running by opening the Redis Client cmd. 您可以通过打开Redis Client cmd来检查您的本地服务是否正在运行。 If you are on a MAC open the command line and type redis-cli. 如果您在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服务。

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);

I've had the same issue when integrating my software with local Redis installation.将我的软件与本地 Redis 安装集成时,我遇到了同样的问题。 Turned out "localhost" host name was not resolved (stuff was was running in a docker container which didn't know that).原来“localhost”主机名没有解析(东西在不知道的 docker 容器中运行)。 Changed it to regular loopback IP "127.0.0.1" in the client config and it rolls.在客户端配置中将其更改为常规环回 IP "127.0.0.1" 并滚动。

My issue was that I was using Docker Compose and needed to use the name of the container instead of 'localhost'.我的问题是我使用的是 Docker Compose 并且需要使用容器的名称而不是“localhost”。

// Connect to the Redis Docker created server. 'redis' refers to the
// 'redis' container in the docker-compose.yml file.
$redis->connect('redis');
// docker-compose.yml
redis:
    image: redis:alpine
    volumes:
        - redis-data:/data
    ports:
        - ${FORWARD_REDIS_PORT:-6379}:6379
    healthcheck:
        test: ["CMD", "redis-cli", "ping"]
    networks:
        - default

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 PHP Redis 错误:未捕获的异常“RedisException” - PHP Redis Error: Uncaught exception ‘RedisException’ PHP致命错误:消息“与Redis服务器的连接断开”未捕获的异常“ CredisException” - PHP Fatal error: Uncaught exception 'CredisException' with message 'Lost connection to Redis server 致命错误:消息为“ 1048”的未捕获异常“ Exception” - Fatal error: Uncaught exception 'Exception' with message '1048 PHP致命错误:带有消息的未捕获异常“异常” - PHP fatal error: Uncaught exception 'Exception' with message 致命错误:消息为“ DateTimeZone ::?”的未捕获异常“ Exception” - Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::? PHPExcel-致命错误:带有消息的未捕获异常“ Exception” - PHPExcel - Fatal error: Uncaught exception 'Exception' with message 致命错误:消息为“序列化的”的未捕获异常“ Exception” - Fatal error: Uncaught exception 'Exception' with message 'Serialization of 致命错误:消息'DateTime ::'未捕获异常'Exception' - Fatal error: Uncaught exception 'Exception' with message 'DateTime:: 致命错误:消息为“无法检索服务器信息[401]”的未捕获异常“ Everyman \\ Neo4j \\ Exception”: - Fatal error: Uncaught exception 'Everyman\Neo4j\Exception' with message 'Unable to retrieve server info [401]: WP LESSPHP->致命错误:未捕获的异常“ Exception”,消息为“ load error”: - WP LESSPHP -> Fatal error: Uncaught exception 'Exception' with message 'load error:
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM