spotahome / redis-operator

Redis Operator creates/configures/manages high availability redis with sentinel automatic failover atop Kubernetes.
Apache License 2.0
1.49k stars 356 forks source link

[Question] Only use sentinel configuration possible? #614

Closed h0jeZvgoxFepBQ2C closed 11 months ago

h0jeZvgoxFepBQ2C commented 1 year ago

Expected behaviour

Don't run a redis cluster in "cluster mode"; but only in sentinel mode. We are using sidekiq and the documentation mentions following: https://github.com/sidekiq/sidekiq/wiki/Using-Redis#architecture

Cluster is NOT appropriate for Sidekiq as Sidekiq has a few very hot keys which are constantly changing (aka queues) and Cluster cannot guarantee high-performance transactions, necessary to keep your job system fast and consistent.

So we would like to use only sentinel mode, but are not sure if this operator allows this / configures correctly.

Actual behaviour

Not sure if possible. would be good to document this.

Steps to reproduce the behaviour

Setting

sentinel:
  replicas: 3

redis:
  replicas: 1

I can create a PR to improve the documentation to clarify if this is no problem to do! Thank you for your great work! ❤️

dcoxall commented 1 year ago

I think this is just a mis-understanding. Sentinel is a separate process/container/service that monitors a standalone redis setup. A traditional redis setup is 1 leader and multiple followers/replicas. The issue with this setup is that the leader isn't redundant if it fails. This is where sentinel gets involved. Sentinel wraps this redis setup and will issue the relevant commands to a follower to promote it to a leader if the current leader fails.

So that means you need redis nodes and sentinel nodes.

The sentinel.replicas indicates the desired number of sentinel nodes whilst redis.replicas indicated the desired number of traditional redis nodes. The sentinel nodes do not handle the typical key value redis work.

edit: This also means that a single redis node makes no sense wrapped with sentinel as the single node will become the leader and if it fails sentinel has no other nodes to promote to replace it as there is no replication in the system.

github-actions[bot] commented 11 months ago

This issue is stale because it has been open for 45 days with no activity.

github-actions[bot] commented 11 months ago

This issue was closed because it has been inactive for 14 days since being marked as stale.