laravel redis sentinel 和 redis cluster 配置

时间:2023-03-09 19:26:27
laravel redis sentinel 和 redis cluster 配置

laravel redis sentinel配置:

'redis' => [
'cluster' => false, 'options' => [
'replication' => 'sentinel',
'service' => 'redis-master',
'parameters' => [
'password' => 'xxxxxxx',
'database' => 0,
],
], 'default' => [
'tcp://192.168.0.11:27000', 'tcp://192.168.0.23:27002', 'tcp://192.168.0.24:27001',
],
],

laravel redis cluster配置:

    'redis' => [

        'cluster' => true,

        'options' => ['cluster' => 'redis'],

        'default' => [
[
'host' => '192.168.0.11',
'port' => 6381,
'database' => 0,
'timeout' => 15,
'read_write_timeout' => 1800, //redis客户端连接以后的读写超时时间(默认是60s)
'password' => null,
],
[
'host' => '192.168.0.11',
'port' => 6382,
'database' => 0,
'timeout' => 15,
'read_write_timeout' => 1800,
'password' => null,
],
[
'host' => '192.168.0.11',
'port' => 6383,
'database' => 0,
'timeout' => 15,
'read_write_timeout' => 1800,
'password' => null,
],
[
'host' => '192.168.0.11',
'port' => 6384,
'database' => 0,
'timeout' => 15,
'read_write_timeout' => 1800,
'password' => null,
],
[
'host' => '192.168.0.11',
'port' => 6385,
'database' => 0,
'timeout' => 15,
'read_write_timeout' => 1800,
'password' => null,
],
[
'host' => '192.168.0.11',
'port' => 6386,
'database' => 0,
'timeout' => 15,
'read_write_timeout' => 1800,
'password' => null,
]
],
],