vetruvet / laravel-phpredis

Use phpredis as the redis connection in Laravel
Apache License 2.0
43 stars 9 forks source link

Connection timed out #14

Open niefajun opened 7 years ago

niefajun commented 7 years ago

we use phpredis in our laravel project and we use redis frequency,sometimes the following problems occur:(9 error in one second) [2017-07-04 09:55:55] local.ERROR: exception 'ErrorException' with message 'Redis::connect(): connect() failed: Connection timed out' in /home/www/xiang5APP/vendor/vetruvet/laravel-phpredis/src/Vetruvet/PhpRedis/Database.php:95 [2017-07-04 09:55:55] local.ERROR: exception 'ErrorException' with message 'Redis::connect(): connect() failed: Connection timed out' in /home/www/xiang5APP/vendor/vetruvet/laravel-phpredis/src/Vetruvet/PhpRedis/Database.php:95

and our database.php configure is: 'redis' => [

    'cluster' => false,

    'default' => [
        'host'     => env('REDIS_HOST', 'localhost'),
        'password' => env('REDIS_PASSWORD', null),
        'port'     => env('REDIS_PORT', 6379),
        'database' => 10,
    'timeout'    => 0,
        'serializer' => 'none'
    ],
]

For the first time, please shine more. thank you very much.

niefajun commented 7 years ago

have already solve it: add an option config: 'persistent' => 'true' //source code use isset method to check config so save many connection and disconnection, there is no any error report,now in the observation stage.