Redis群集的配置

时间:2016-07-15 15:01:20

标签: php laravel redis laravel-5.1

我在GlusterFS集群中运行Laravel,我也想设置一个redis集群。我无法了解如何配置Laravel。

这是示例配置文件:

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

如何添加多台服务器?

1 个答案:

答案 0 :(得分:1)

我假设您只是在那里添加另一台服务器并更新cluster布尔值:

'redis' => [
    'cluster' => true,
    'default' => [
        'host' => env('REDIS_HOST', 'localhost'),
        'password' => env('REDIS_PASSWORD', null),
        'port' => env('REDIS_PORT', 6379),
        'database' => 0,
    ],
    'secondary' => [
        'host'     => '127.0.0.1',
        'password' => 'p@ssw0rd',
        'port'     => 6379,
        'database' => 0,
    ],
],