• Resolved aparnawd

    (@aparnawd)


    Hi,

    We are using AWS Redis Elastic Cache with 2 Shards and cluster mode enabled. On activating the Object Cache option by giving comma separated endpoints such as example1amazonaws.com:6379, example2amazonaws.com:6379 we are getting the below “MOVED Error”.
    Fatal error: Uncaught RedisException: MOVED 9127 10.0.5.103:6379 in /wp-content/plugins/w3-total-cache/Cache_Redis.php:91 Stack trace: #0 /wp-content/plugins/w3-total-cache/Cache_Redis.php(91): Redis->get() #1 /wp-content/plugins/w3-total-cache/Cache_Base.php(96): W3TC\Cache_Redis->get_with_old() #2 /wp-content/plugins/w3-total-cache/ObjectCache_WpObjectCache_Regular.php(153): W3TC\Cache_Base->get() #3 /wp-content/plugins/w3-total-cache/ObjectCache_WpObjectCache.php(36): W3TC\ObjectCache_WpObjectCache_Regular->get() #4 /wp-content/object-cache.php(52): W3TC\ObjectCache_WpObjectCache->get() #5 /wp-includes/functions.php(1724): wp_cache_get() #6 /wp-includes/load.php(752): is_blog_installed() #7 wp-settings.php(159): wp_not_installed() #8 /wp-config.php(103): require_once('...') #9 /wp-load.php(50): require_once('...') #10 /wp-admin/admin.php(34): require_once('...') #11 {main} thrown in /wp-content/plugins/w3-total-cache/Cache_Redis.php on line 91

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @aparnawd

    `am sorry about the issue you are experiencing and I am happy to assist you with this. The second section of the Redis Cluster Spec Document explains the server’s “MOVED” reply:

    Since cluster nodes are not able to proxy requests, clients may be redirected to other nodes using redirection errors -MOVED and -ASK. The client is in theory free to send requests to all the nodes in the cluster, getting redirected if needed, so the client is not required to hold the state of the cluster. However clients that are able to cache the map between keys and nodes can improve the performance in a sensible way.

    Redis Cluster shards your data set. In other words, it divides your data set up among your, for example, three master servers so each master has about 1/3rd of the keys. The point here being that the master does not have the other 2/3rds of the keys. When you talk to one master, it can accept reads and writes for the keys it has. It cannot accept reads or writes for the other keys.

    As the document explains, the Redis servers (masters) do not proxy your request over to the server that has the key you’re asking for. Instead, it returns a redirection reply, “MOVED” or “ASK”, which informs your client it should talk to one of the other servers to read/write that key. The “MOVED” reply usually suggests the correct server to talk to.

    Apparently, the client you’re using does not support Redis’s sharding Cluster mode, because instead of connecting to the suggested server, it throws an exception back to your code. Or perhaps the client supports Cluster mode, but you haven’t told it to use that mode.
    If you’re using Redis-cli, then you must use the -c option if you want it to follow these redirects.
    for Cluster you should use RedisCluster class.

    If you use the same configuration for each server, there should only be one “server” in the W3TC config e.g. 127.0.0.1:6379 for Redis.
    Multiple servers may be used and separated with a comma;
    For example:
    Redis hostname:port / IP:port:
    192.168.1.100:11211, domain.com:22122

    I hope this helps!

    Thread Starter aparnawd

    (@aparnawd)

    Hi,

    Please confirm whether we need a PHP REDIS client installed in addition to enabling php redis extension.

    Is there any client that is commonly used?

    Thread Starter aparnawd

    (@aparnawd)

    Hi,
    Also when I give the configuration endpoint from aws how does w3 total cache identify it as main cluster endpoint? Do we have to specify it anywhere?

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @aparnawd

    There is an example config ini/dbcluster-config-sample.php
    once edited and placed to /wp-content/db-cluster-config.php it starts to work.
    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘AWS Redis Elastic Cache with 2 Shards’ is closed to new replies.