Hi,
We've been using this module successfully in production for a few years, but lately started having problems with performance in our Redis cluster (we're using Elasticache).
We're using Cluster Disabled and would like to use a node replica to alleviate load.
Looking at the docs it's not completely clear to me how we can achieve this.
Using PHPRedis
We're currently using PHPRedis and ideally we'd like to keep doing so, however, the replication examples in the README don't seem to apply to it. Is that supported? If so, how do I achieve this?
Using Predis
Assuming it's not possible to keep using PHPRedis, we'd need to transition to Predis, although it says it's experimental still. How successfully is this being used in production systems?
For testing purposes I setup some replica nodes in a staging environment and tried to configure things as per README docs, like so:
$settings['redis.connection']['interface'] = 'Predis'; // Use predis library.
$settings['redis.connection']['replication'] = TRUE; // Turns on replication.
$settings['redis.connection']['replication.host'][1]['host'] = '1.2.3.4'; // Your Redis instance hostname.
$settings['redis.connection']['replication.host'][1]['port'] = '6379'; // Only required if using non-standard port.
$settings['redis.connection']['replication.host'][1]['role'] = 'primary'; // The redis instance role.
$settings['redis.connection']['replication.host'][2]['host'] = '1.2.3.5';
$settings['redis.connection']['replication.host'][2]['port'] = '6379';
$settings['redis.connection']['replication.host'][2]['role'] = 'replica';
However, when I do this I get the following error:
InvalidArgumentException: Predis\Configuration\Option\Replication expects either a string or a callable value, boolean given in Predis\Configuration\Option\Replication->filter() (line 40 of /var/www/html/vendor/predis/predis/src/Configuration/Option/Replication.php).
Debugging this, it seems like a string is expected (for the replication flag), but in the README we're passing a boolean. If I change the paremeter to be a string "true" however, then that breaks in the Drupal's Redis implementation, specifically here in ClientFactory:
// If using replication, lets create the client appropriately.
if (isset($settings['replication']) && $settings['replication'] === TRUE) {
foreach ($settings['replication.host'] as $key => $replicationHost) {
if (!isset($replicationHost['port'])) {
$settings['replication.host'][$key]['port'] = self::REDIS_DEFAULT_PORT;
}
}
Can someone assist me with this one?
Thanks in advance!