Title: Redis cluster
Last modified: July 10, 2020

---

# Redis cluster

 *  Resolved [ramanm](https://wordpress.org/support/users/ramanm/)
 * (@ramanm)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/redis-cluster/)
 * Hi WP Redis,
    I have been using your plugin for few years. It is very reliable.
   Thank you.
 * Two questions:
    1. In AWS, I have one shard with 2 nodes — primary and a replica.
   I see cache hits in the primary, but no cache hits in the replica. This made 
   me think that our site is reading only from the primary node and not from the
   replica. The AWS documentation mentions: “Redis (cluster mode enabled) clusters,
   use the cluster’s Configuration Endpoint for all operations. You must use a client
   that supports Redis Cluster (Redis 3.2). You can still read from individual node
   endpoints (In the API/CLI these are referred to as Read Endpoints).” We would
   like the read accesses to be load-balanced between the 2 nodes. It appears that
   this is not happening. Could you shed some light on this? Does WP-Redis support
   Redis Cluster as mentioned above?
 * 2. After some plugin update, we started getting sporadic Connection timeout with
   the following exception. After this exception, our site appears to become slow.
   So, I felt maybe after the exception, the wordpress does not recover. For now,
   I upgraded the redis server thinking maybe the load on the server could be causing
   the timeout. I have to wait for a day or so to see if that solved the problem.
   Could you kindly check if this exception is recoverable or anything need to be
   fixed?
    [10-Jul-2020 20:52:35 UTC] PHP Warning: WP Redis: Connection timed out
   in wp-content/plugins/wp-redis/object-cache.php on line 1296 [10-Jul-2020 20:
   52:35 UTC] PHP Notice: Undefined property: WP_Object_Cache::$redis in wp-content/
   plugins/wp-redis/object-cache.php on line 1031 [10-Jul-2020 20:52:35 UTC] PHP
   Fatal error: Uncaught Error: Call to a member function auth() on null in /var/
   www/html/ebs/wordpress/web/wp-content/plugins/wp-redis/object-cache.php:1140 
   Stack trace: #0 wp-content/plugins/wp-redis/object-cache.php(1031): WP_Object_Cache-
   >perform_client_connection() #1 wp-content/plugins/wp-redis/object-cache.php(
   1340): WP_Object_Cache->_connect_redis() #2 wp-content/plugins/wp-redis/object-
   cache.php(162): WP_Object_Cache->__construct() #3 wp-includes/load.php(580): 
   wp_cache_init() #4 wp-settings.php(133): wp_start_object_cache() #5 wp-config.
   php(131): require_once(‘/var/www/html/e…’) #6 wp-load.php(37): require_once(‘/
   var/www/html/e…’) #7 wp-admin/admin-ajax.php(22): require_once(‘/var/www/html/
   e…’) #8 {main} thrown in wp-content/plugins/wp-redis/object-cache.php on line
   1140
 * Thank you,
    Raman

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Contributor [Daniel Bachhuber](https://wordpress.org/support/users/danielbachhuber/)
 * (@danielbachhuber)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/redis-cluster/#post-13117704)
 * Hi [@ramanm](https://wordpress.org/support/users/ramanm/),
 * Thanks for the kind words
 * > We would like the read accesses to be load-balanced between the 2 nodes. It
   > appears that this is not happening. Could you shed some light on this? Does
   > WP-Redis support Redis Cluster as mentioned above?
 * I, too, suspect it’s probably not happening. The [instantiation of RedisCluster](https://github.com/phpredis/phpredis/blob/develop/cluster.markdown#redis-cluster)
   is different than how WP Redis [instantiates the Redis client](https://github.com/pantheon-systems/wp-redis/blob/8a367eac654011897f4cb8a5ef079d887b8d2b51/object-cache.php#L1110-L1122).
   It is possible to [filter the connection](https://github.com/pantheon-systems/wp-redis/blob/8a367eac654011897f4cb8a5ef079d887b8d2b51/object-cache.php#L1012),
   however, so you might be able to get it to work with a little bit of PHP.
 * > fter some plugin update, we started getting sporadic Connection timeout with
   > the following exception. After this exception, our site appears to become slow.
   > So, I felt maybe after the exception, the wordpress does not recover. For now,
   > I upgraded the redis server thinking maybe the load on the server could be 
   > causing the timeout. I have to wait for a day or so to see if that solved the
   > problem. Could you kindly check if this exception is recoverable or anything
   > need to be fixed?
 * The connection itself isn’t going to be recoverable because your Redis server
   is under load. And the slowness, unfortunately, is probably because you no longer
   have a persistent object cache.
 * However, WP Redis shouldn’t be triggering a fatal error either (and I’m surprised
   it took this long to come up). In [this pull request](https://github.com/pantheon-systems/wp-redis/pull/285),
   I’ve improved the connection logic such that a failed connection will fall back
   to the internal object cache instead of causing a fatal. It will be released 
   in v1.1.0.
 * Hope this helps!
 *  Thread Starter [ramanm](https://wordpress.org/support/users/ramanm/)
 * (@ramanm)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/redis-cluster/#post-13119565)
 * Hi Daniel,
 * Thank you very much for the prompt response and for fixing the issue. Because
   of your response I have a better understanding of the cluster now.
 * Thank you,
    Raman

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Redis cluster’ is closed to new replies.

 * ![](https://ps.w.org/wp-redis/assets/icon-256x256.png?rev=3417699)
 * [WP Redis](https://wordpress.org/plugins/wp-redis/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-redis/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-redis/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-redis/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-redis/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-redis/reviews/)

## Tags

 * [cluster](https://wordpress.org/support/topic-tag/cluster/)

 * 2 replies
 * 2 participants
 * Last reply from: [ramanm](https://wordpress.org/support/users/ramanm/)
 * Last activity: [5 years, 11 months ago](https://wordpress.org/support/topic/redis-cluster/#post-13119565)
 * Status: resolved