From cd86b0cbdd160314cd9bfaa7134cedbbe59da96d Mon Sep 17 00:00:00 2001 From: Lee Ween Jiann Date: Tue, 30 Mar 2021 00:12:24 +0800 Subject: [PATCH 1/2] Add redis connection env --- config/broadcasting.php | 2 +- config/cache.php | 2 +- config/queue.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/broadcasting.php b/config/broadcasting.php index 3ca45eaa85..d034dccb21 100644 --- a/config/broadcasting.php +++ b/config/broadcasting.php @@ -43,7 +43,7 @@ return [ 'redis' => [ 'driver' => 'redis', - 'connection' => 'default', + 'connection' => env('REDIS_BROADCAST_CONNECTION', 'default'), ], 'log' => [ diff --git a/config/cache.php b/config/cache.php index 4f41fdf966..b054ca87d6 100644 --- a/config/cache.php +++ b/config/cache.php @@ -74,7 +74,7 @@ return [ 'redis' => [ 'driver' => 'redis', - 'connection' => 'cache', + 'connection' => env('REDIS_CACHE_CONNECTION', 'cache'), ], 'dynamodb' => [ diff --git a/config/queue.php b/config/queue.php index dc2d4665ea..8f826c982b 100644 --- a/config/queue.php +++ b/config/queue.php @@ -61,7 +61,7 @@ return [ 'redis' => [ 'driver' => 'redis', - 'connection' => 'default', + 'connection' => env('REDIS_QUEUE_CONNECTION', 'default'), 'queue' => env('REDIS_QUEUE', 'default'), 'retry_after' => 90000000, 'block_for' => null, From 23c5ee778523f201cd3d2a083f6e2137a055ebac Mon Sep 17 00:00:00 2001 From: Lee Ween Jiann Date: Mon, 5 Apr 2021 16:08:02 +0800 Subject: [PATCH 2/2] Added redis sentinel to database.php --- config/database.php | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/config/database.php b/config/database.php index 1d338edd5d..a59440a08e 100644 --- a/config/database.php +++ b/config/database.php @@ -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), + ], + ]] + ), + ], ];