Predis with laravel 5.5 “No connections available in the pool in Aggregate/RedisCluster.php:337 ”

后端 未结 2 1742
忘了有多久
忘了有多久 2021-01-06 00:30

I\'ve setup redis-cluster on Amazon ElastiCache for cache, using Laravel 5.5 and Predis package, I get the following error.

Predis\\ClientException: No conne         


        
相关标签:
2条回答
  • 2021-01-06 01:04

    I think the problem is that I'm trying to switch amz cloud service by service... ANd redis can only be accessed through the vpc which I'm not in this case.

    I need to test is from an ec2 inside the vpc for testing.

    0 讨论(0)
  • 2021-01-06 01:12

    This is working in in our env:

        'redis' => [
             'cluster' => true,
    
             'client' => 'predis',
    
             'options' => [
                 'cluster' => 'redis',
                 'parameters' => [
                     'scheme'   => env('REDIS_SCHEME', 'tcp'),
                     'host'     => env('REDIS_HOST', 'localhost'),
                     'password' => env('REDIS_PASSWORD', null),
                     'port'     => env('REDIS_PORT', 6379),
                     'database' => 0,
                     'timeout' => 15,
                  ],
             ],
    
             'clusters' => [
    
                 'default' => [
                     'scheme'   => env('REDIS_SCHEME', 'tcp'),
                     'host'     => env('REDIS_HOST', 'localhost'),
                     'password' => env('REDIS_PASSWORD', null),
                     'port'     => env('REDIS_PORT', 6379),
                     'database' => 0,
                     'timeout' => 15,
                 ],
             ],
         ],
    

    Based on info found here: https://github.com/nrk/predis/issues/480 - but needed to also replicate all 'default' config values in the options -> parameters group

    REDIS_HOST, is pointing to the configuration endpoint in AWS elasticache's redis cluster.

    0 讨论(0)
提交回复
热议问题