我在laravel.log中有很多错误,频率为每4-5秒2个错误。
错误如下:
[2020-12-09 16:37:09] production.ERROR: Connection refused {"exception":"[object] (RedisException(code: 0): Connection refused at /home/ubuntu/myuser/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php:141)
[stacktrace]
#0 /home/ubuntu/myuser/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php(141): Redis->connect()
#1 /home/ubuntu/myuser/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php(84): Illuminate\Redis\Connectors\PhpRedisConnector->establishConnection()
#2 /home/ubuntu/myuser/vendor/laravel/framework/src/Illuminate/Support/helpers.php(263): Illuminate\Redis\Connectors\PhpRedisConnector->Illuminate\Redis\Connectors\{closure}()
#3 /home/ubuntu/myuser/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php(109): tap()
#4 /home/ubuntu/myuser/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php(28): Illuminate\Redis\Connectors\PhpRedisConnector->createClient()
#5 [internal function]: Illuminate\Redis\Connectors\PhpRedisConnector->Illuminate\Redis\Connectors\{closure}()
#6 /home/ubuntu/myuser/vendor/laravel/framework/src/Illuminate/Redis/Connections/PhpRedisConnection.php(541): call_user_func()
#7 /home/ubuntu/myuser/vendor/laravel/framework/src/Illuminate/Redis/Connections/PhpRedisConnection.php(272): Illuminate\Redis\Connections\PhpRedisConnection->command()
#8 /home/ubuntu/myuser/vendor/laravel/horizon/src/Repositories/RedisSupervisorRepository.php(39): Illuminate\Redis\Connections\PhpRedisConnection->zrevrangebyscore()
#9 /home/ubuntu/myuser/vendor/laravel/horizon/src/Repositories/RedisSupervisorRepository.php(50): Laravel\Horizon\Repositories\RedisSupervisorRepository->names()
#10 /home/ubuntu/myuser/vendor/laravel/horizon/src/Repositories/RedisSupervisorRepository.php(99): Laravel\Horizon\Repositories\RedisSupervisorRepository->all()
#11 /home/ubuntu/myuser/vendor/laravel/horizon/src/MasterSupervisor.php(165): Laravel\Horizon\Repositories\RedisSupervisorRepository->longestActiveTimeout()
#12 /home/ubuntu/myuser/vendor/laravel/horizon/src/ListensForSignals.php(52): Laravel\Horizon\MasterSupervisor->terminate()
#13 /home/ubuntu/myuser/vendor/laravel/horizon/src/MasterSupervisor.php(237): Laravel\Horizon\MasterSupervisor->processPendingSignals()
#14 /home/ubuntu/myuser/vendor/laravel/horizon/src/MasterSupervisor.php(212): Laravel\Horizon\MasterSupervisor->loop()
#15 /home/ubuntu/myuser/vendor/laravel/horizon/src/Console/HorizonCommand.php(56): Laravel\Horizon\MasterSupervisor->monitor()
#16 /home/ubuntu/myuser/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Laravel\Horizon\Console\HorizonCommand->handle()
#17 /home/ubuntu/myuser/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#18 /home/ubuntu/myuser/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#19 /home/ubuntu/myuser/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()
#20 /home/ubuntu/myuser/vendor/laravel/framework/src/Illuminate/Container/Container.php(610): Illuminate\Container\BoundMethod::call()
#21 /home/ubuntu/myuser/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\Container\Container->call()
#22 /home/ubuntu/myuser/vendor/symfony/console/Command/Command.php(255): Illuminate\Console\Command->execute()
#23 /home/ubuntu/myuser/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run()
#24 /home/ubuntu/myuser/vendor/symfony/console/Application.php(971): Illuminate\Console\Command->run()
#25 /home/ubuntu/myuser/vendor/symfony/console/Application.php(290): Symfony\Component\Console\Application->doRunCommand()
#26 /home/ubuntu/myuser/vendor/symfony/console/Application.php(166): Symfony\Component\Console\Application->doRun()
#27 /home/ubuntu/myuser/vendor/laravel/framework/src/Illuminate/Console/Application.php(93): Symfony\Component\Console\Application->run()
#28 /home/ubuntu/myuser/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Console\Application->run()
#29 /home/ubuntu/myuser/artisan(37): Illuminate\Foundation\Console\Kernel->handle()
#30 {main}
"}
这是我的配置:
'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis'),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_database_'),
],
'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
],
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
],
],
在我的.env:中
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=MyPassword
REDIS_PORT=6379
这是堆栈:
- 地平线版本:5.6.0
- Laravel版本:8.17.0
- PHP版本:7.4.3
- Redis驱动程序&版本:predis/phpredis 5.0.7/1.1.6
- 数据库驱动程序&版本:Postgres 12
我应该怎么做才能摆脱它们?
您应该禁用Selinux或将其设置为允许模式。