Added redis sentinel to database.php

This commit is contained in:
Lee Ween Jiann 2021-04-05 16:08:02 +08:00
parent cd86b0cbdd
commit 23c5ee7785

View File

@ -153,6 +153,42 @@ return [
'database' => env('REDIS_CACHE_DB', 1),
],
'sentinel-default' => array_merge(
array_map(
function ($a, $b) {
return ["host" => $a,"port" => $b];
},
explode(',', env('REDIS_HOST', 'localhost')),
explode(',', env('REDIS_PORT', 26379))
),
['options' => [
'replication' => 'sentinel',
'service' => env('REDIS_SENTINEL_SERVICE', 'mymaster'),
'parameters' => [
'password' => env('REDIS_PASSWORD', null),
'database' => env('REDIS_DB', 0),
],
]]
),
'sentinel-cache' => array_merge(
array_map(
function ($a, $b) {
return ["host" => $a,"port" => $b];
},
explode(',', env('REDIS_HOST', 'localhost')),
explode(',', env('REDIS_PORT', 26379))
),
['options' => [
'replication' => 'sentinel',
'service' => env('REDIS_SENTINEL_SERVICE', 'mymaster'),
'parameters' => [
'password' => env('REDIS_PASSWORD', null),
'database' => env('REDIS_CACHE_DB', 1),
],
]]
),
],
];