rhubarbgroup / redis-cache

A persistent object cache backend for WordPress powered by Redis. Supports Predis, PhpRedis, Relay, replication, sentinels, clustering and WP-CLI.
https://wordpress.org/plugins/redis-cache/
GNU General Public License v3.0
425 stars 148 forks source link

Config question (agregate) for existing working redis cluster #525

Closed ramonfincken closed 3 months ago

ramonfincken commented 3 months ago

We have a working redis cluster on 3 machines.

However we run the site on 2 other nodes and want to expand the cluster to them as well. So 5 redis instances as 1 cluster. We want to connect to the 2 newest redis instances to reduce network necessity.

We are using phpredis

I have read https://github.com/rhubarbgroup/redis-cache/issues/88 https://github.com/rhubarbgroup/redis-cache/issues/311 and https://github.com/rhubarbgroup/redis-cache/issues/26#issuecomment-208081505 plus checked your commit from 2016-04-11 (Added aggregate connections for Predis).

I am a bit confused, how can we "promote" 2 of the 5 instances to be the preferred ones for reading? We want to let redis cluster still be working as intended, to in the end all 5 could handle writes and syncs.

tillkruss commented 3 months ago

All your WordPress instances must point at the same Redis Cluster master node(s). You can get that info by running redis-cli info | grep ^role

define( 'WP_REDIS_CLIENT', 'phpredis' );

define( 'WP_REDIS_CLUSTER', [
    'tcp://0.0.0.1:6379',
    'tcp://0.0.0.2:6380',
    'tcp://0.0.0.3:6381',
] );