Skip to content

Cluster Mode - No READONLY commands on Slave Nodes - All commands forwarded to Master Node #595

@dntosas

Description

@dntosas

Expected behaviour
Predis should evenly distribute readonly commands between masters and slaves

Actual behaviour
Predis forwards readonly cmd to SLAVE but SLAVE responses with MOVED to MASTER node as Predis doesnt instruct the SLAVE that wants to get readonly information. As a result, all commands are executed on MASTER and that break the cluster offerings for scaling and traffic distribution.

Why that happens

There's one important caveat: if a client connects to a replica and sends the command GET foo, the reply will be a MOVED error message even if that replica is in charge of the hash slot where the key "foo" is located. That behavior can be changed by sending first the command READONLY, which instruct the replica to serve the client's request even if the data is stale. The READWRITE command can be used to restore the connection to the original state.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions