• Resolved giuseppect

    (@giuseppect)


    Hi,

    It seems that redis cluster doesn’t work. If I configure the cluster endpoint I got this exception.

    Got error 'PHP message: PHP Fatal error: Uncaught RedisException: MOVED 2663 172.31.0.22:6379 in /public_html/wp-content/plugins/w3-total-cache/Cache_Redis.php:86\nStack trace:\n#0 /public_html/wp-content/plugins/w3-total-cache/Cache_Redis.php(86): Redis->get('w3tc_1121371394...')\n#1 /public_html/wp-content/plugins/w3-total-cache/Cache_Base.php(96): W3TC\\Cache_Redis->get_with_old('0optionsallopti...', '')\n#2 /public_html/wp-content/plugins/w3-total-cache/ObjectCache_WpObjectCache_Regular.php(153): W3TC\\Cache_Base->get('0optionsallopti...')\n#3 /public_html/wp-content/plugins/w3-total-cache/ObjectCache_WpObjectCache.php(36): W3TC\\ObjectCache_WpObjectCache_Regular->get('alloptions', 'options', false, NULL)\n#4 /public_html/wp-content/object-cache.php(52): W3TC\\ObjectCache_WpObjectCache->get('alloptions'...\nPHP message: PHP Stack trace:\nPHP message: PHP 1. newrelic_exception_handler() UNKNOWN?:0\n'

    Could you help me please?

    • This topic was modified 5 years, 1 month ago by giuseppect.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @giuseppect

    I 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.
    Thank you!

    Thread Starter giuseppect

    (@giuseppect)

    Hello Marko,

    thanks for the fast reply!
    If I understand your answer, the issue is in the php client library?

    Giuseppe

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @giuseppect

    Yes, that may be the case or you have not set up something correctly.
    The answer above is why the Uncaught RedisException: MOVED is occurring.
    Thank you!

    Thread Starter giuseppect

    (@giuseppect)

    Reading this : https://github.com/phpredis/phpredis/blob/develop/cluster.markdown#readme

    It seems that for Cluster you should use RedisCluster class. Could be this the issue?

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @giuseppect

    Yes that is correct!

    Thread Starter giuseppect

    (@giuseppect)

    So w3 total cache does not support redis cluster?

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @giuseppect
    W3 Total Cache does support cluster 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
    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Redis cluster suppor’ is closed to new replies.