After many tries,
I think I got a working config by moving the cache key under clusters :
'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis'),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_database_'),
],
'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
],
// 'cache' => [
// 'url' => env('REDIS_URL'),
// 'host' => env('REDIS_HOST', '127.0.0.1'),
// 'password' => env('REDIS_PASSWORD', null),
// 'port' => env('REDIS_PORT', '6379'),
// 'database' => env('REDIS_CACHE_DB', '1'),
// ],
'clusters' => [
'cache' => [
[
'host' => 'hubavocat-redis1',
'password' => env('REDIS_PASSWORD', null),
'port' => 6379,
'database' => 1,
],
[
'host' => 'hubavocat-redis2',
'password' => env('REDIS_PASSWORD', null),
'port' => 6380,
'database' => 1,
],
],
],
],
However, I cannot write cache as I get the error :
>>> Cache::put('test4', 'test');
RedisClusterException with message 'Couldn't map cluster keyspace using any provided seed'
Something I do not understand : do my Redis needs to be setup and configured in cluster mode on server side ? Or can PHPRedis do all the job from client side ?