Closed
Description
Description
The version 5.2.0 of the Redis PHP extension, released back in March 2020, added support for Redis Sentinel mode with the help of the RedisSentinel
class.
A connection to the elected master can be created as such:
$sentinel = new RedisSentinel($address, $port);
$master = $sentinel->getMasterAddrByName($masterName);
$connection = new Redis(sprintf('redis://%s:%d', $master[0], $master[1]));
Example
Usage of the Symfony/Cache RedisAdapter
can continue to be the same, thus relying on the $options['redis_persistent']
option to both enable and define the master name.