我使用的是拉维勒8/家园/地平线/redis/诺瓦
周期性地,我的日志中会出现一个错误
[2020-10-21 09:05:03] local.ERROR: Connection refused {"exception":"[object] (RedisException(code: 0): Connection refused at /home/julien/Code/acc/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php:135)
[stacktrace]
# 0 /home/julien/Code/acc/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php(135): Redis->connect()
# 1 /home/julien/Code/acc/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php(84): Illuminate\\Redis\\Connectors\\PhpRedisConnector->establishConnection()
# 2 /home/julien/Code/acc/vendor/laravel/framework/src/Illuminate/Support/helpers.php(263): Illuminate\\Redis\\Connectors\\PhpRedisConnector->Illuminate\\Redis\\Connectors\\{closure}()
# 3 /home/julien/Code/acc/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php(105): tap()
# 4 /home/julien/Code/acc/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php(28): Illuminate\\Redis\\Connectors\\PhpRedisConnector->createClient()
# 5 /home/julien/Code/acc/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php(32): Illuminate\\Redis\\Connectors\\PhpRedisConnector->Illuminate\\Redis\\Connectors\\{closure}()
# 6 /home/julien/Code/acc/vendor/laravel/framework/src/Illuminate/Redis/RedisManager.php(110): Illuminate\\Redis\\Connectors\\PhpRedisConnector->connect()
# 7 /home/julien/Code/acc/vendor/laravel/framework/src/Illuminate/Redis/RedisManager.php(90): Illuminate\\Redis\\RedisManager->resolve()
# 8 /home/julien/Code/acc/vendor/laravel/horizon/src/Lock.php(93): Illuminate\\Redis\\RedisManager->connection()
# 9 /home/julien/Code/acc/vendor/laravel/horizon/src/Lock.php(66): Laravel\\Horizon\\Lock->connection()
# 10 /home/julien/Code/acc/vendor/laravel/horizon/src/Console/SnapshotCommand.php(34): Laravel\\Horizon\\Lock->get()
# 11 [internal function]: Laravel\\Horizon\\Console\\SnapshotCommand->handle()
# 12 /home/julien/Code/acc/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): call_user_func_array()
# 13 /home/julien/Code/acc/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
# 14 /home/julien/Code/acc/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(95): Illuminate\\Container\\Util::unwrapIfClosure()
# 15 /home/julien/Code/acc/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(39): Illuminate\\Container\\BoundMethod::callBoundMethod()
# 16 /home/julien/Code/acc/vendor/laravel/framework/src/Illuminate/Container/Container.php(596): Illuminate\\Container\\BoundMethod::call()
# 17 /home/julien/Code/acc/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\\Container\\Container->call()
# 18 /home/julien/Code/acc/vendor/symfony/console/Command/Command.php(258): Illuminate\\Console\\Command->execute()
# 19 /home/julien/Code/acc/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\\Component\\Console\\Command\\Command->run()
# 20 /home/julien/Code/acc/vendor/symfony/console/Application.php(920): Illuminate\\Console\\Command->run()
# 21 /home/julien/Code/acc/vendor/symfony/console/Application.php(266): Symfony\\Component\\Console\\Application->doRunCommand()
# 22 /home/julien/Code/acc/vendor/symfony/console/Application.php(142): Symfony\\Component\\Console\\Application->doRun()
# 23 /home/julien/Code/acc/vendor/laravel/framework/src/Illuminate/Console/Application.php(93): Symfony\\Component\\Console\\Application->run()
# 24 /home/julien/Code/acc/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\\Console\\Application->run()
# 25 /home/julien/Code/acc/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle()
# 26 {main}
"}
我想这是因为:
$schedule->command('horizon:snapshot')->everyFiveMinutes();
似乎horizon无法发出snapshot命令并获得redis的锁。
不过,我可以确认laravel horizon正在运行,有一个主管,当我手动执行时:
php artisan horizon:snapshot
我没有错误,我让它工作。
为什么从cron运行时和手动运行时不同???
暂无答案!
目前还没有任何答案,快来回答吧!