我使用predis与laravel集成,在某些情况下predis有连接超时,但是当我试图通过cli连接redis服务器时,我连接得很完美
有人能帮我解决这个问题吗?
Predis\Connection\ConnectionException {#7222-connection: Predis\Connection\StreamConnection {#7171
-resource: null
-cachedId: null
#parameters: Predis\Connection\Parameters {#7178
-parameters: array:5 [
"host" => "Host"
"password" => "Password"
"port" => "6379"
"database" => 0
"scheme" => "tcp"
]
}
#initCommands: array:1 [
0 => Predis\Command\RawCommand {#7218
-slot: null
-commandID: "SELECT"
-arguments: array:1 [
0 => 0
]
}
]}#message: "Connection timed out [tcp://Host:6379]" #code: 110 #file:"./vendor/predis/predis/src/Connection/AbstractConnection.php" #line: 155任何帮助都将不胜感激!
发布于 2022-04-09 11:21:43
正如您在调试数据中看到的,您的主机被设置为Host。我假设您在本地主机上安装了redis,在您的.env文件中设置了以下变量。而且你的密码似乎关了,也调整一下,大部分本地红电脑安装有一个空白密码。
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=如果服务器上有redis,则相应地设置ip。
https://stackoverflow.com/questions/71806636
复制相似问题