Laravel + predis + Redis cluster - MOVED / no connection to 127.0.0.1:6379

后端 未结 5 614
别跟我提以往
别跟我提以往 2020-12-15 13:28

I have a laravel (5.3) app with redis used for sessions (using predis). Everything works as long as I use a single redis node (using default approach from config/databas

5条回答
  •  遥遥无期
    2020-12-15 14:16

    For AWS elasticcache redis cluster the above configuration did not work, however below are working for me. Also mentioned in the documentation: https://laravel.com/docs/5.4/redis#configuration

    'redis' => [
        'client' => 'predis',
        'options' => [
            'cluster' => 'redis',
        ],
        'clusters' => [
            'default' => [
                [
                    'host' => env('REDIS_HOST', 'localhost'),
                    'password' => env('REDIS_PASSWORD', null),
                    'port' => env('REDIS_PORT', 6379),
                    'database' => 0,
                ],
            ],
        ],
    ],
    

提交回复
热议问题