Skip to content

[FEATURE] Support for a REDIS cluster #2811

@Lt-Flash

Description

@Lt-Flash

Is your feature request related to a problem? Please describe.
It's both a feature request and a problem we've experienced. We were using a single instance of REDIS server without any issues for a long time. Recently we have deployed a REDIS cluster consisting of three MASTER nodes and three SLAVE nodes and run into an issue. REDIS protocol shards data between nodes in a cluster so when you're connected to M1 node (for example) but KEY you're looking for is on another node REDIS will respond with (for example):

MOVED 16281 192.168.0.14:6379

And as per REDIS documentation (https://redis.io/docs/reference/cluster-spec/):

The error includes the hash slot of the key (3999) and the endpoint:port of the instance that can serve the query. The client needs to reissue the query to the specified node's endpoint address and port. The endpoint can be either an IP address, a hostname, or it can be empty (e.g. -MOVED 3999 :6380). An empty endpoint indicates that the server node has an an unknown endpoint, and the client should send the next request to the same endpoint as the current request but with the provided port.

Note that even if the client waits a long time before reissuing the query, and in the meantime the cluster configuration changed, the destination node will reply again with a MOVED error if the hash slot 3999 is now served by another node. The same happens if the contacted node had no updated information.

This behaviour disallows us to use REDIS cluster even with HAProxy or some other load balancer in front of it as the proxy can't analyze actual REDIS protocol and re-connect client to another REDIS node.

Describe the solution you'd like
Update OpenSIPS REDIS cache module to support recent version of REDIS cluster.

Implementation

  • Component: cachedb_redis
  • Type: List of REDIS nodes to connect to initially (it can be any master node)
  • Name: Up to developers

Describe alternatives you've considered
The only alternative is to continue using a single REDIS instance with a probable VRRP backup and some synchronization between them.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions