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

后端 未结 5 599
别跟我提以往
别跟我提以往 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条回答
  •  -上瘾入骨i
    2020-12-15 14:16

    Please refer to [ https://laravel.com/docs/5.5/redis ].

    Make sure you have the proper library

    composer require predis/predis
    

    In config/database.php as well as config/queue.php [ if your queue is also using clustered reddis]

    '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,
                ],
            ],
        ],
    
    ]
    

提交回复
热议问题