TransWikia.com

Redis Cluster Mode - replicas not working

Stack Overflow Asked by RamPrakash on December 9, 2021

I tried to set up redis cluster as per this tutorial.

https://redis.io/topics/cluster-tutorial

I was able to set this up by using something like this.

redis-cli --cluster create 127.0.0.1:7000 127.0.0.1:7001 
127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005 
--cluster-replicas 1

3 masters and 3 replicas. Cluster status is shown as OK and up.

Let’s consider

  • a1 is master and corresponding replica b1
  • a2 is master and corresponding replica b2
  • a3 is master and corresponding replica b3

All the slots were equally distributed among 3 masters. I added a key. For example,

Set "a" "a"

Lets also assume it goes to a2 as per the slot. I see that in a2.

But I do not see that replicated in b2. What could be the reason? i double checked that I correctly checked in the corresponding replica. In fact none of replica nodes b1, b2, b3 has any keys replicated.

Cluster nodes shows this

114265674babd48842e2740e605ad0befa4e2f6b 192.168.224.6:6379@16379 slave eca661b39de5903aba3f495f941fa4025a968b55 0 1594860801511 4 connected
39fe499da446216124c28e0846f6d2fa711a5947 192.168.224.8:6379@16379 myself,slave d7ad5bbb986fb036b51e278739932fd704a91713 0 1594860802000 6 connected
eca661b39de5903aba3f495f941fa4025a968b55 192.168.224.4:6379@16379 master - 0 1594860802512 3 connected 10923-16383
e367fb2a13e5027e657d2c7af50d462c57b14d0b 192.168.224.2:6379@16379 master - 0 1594860802000 1 connected 0-5460
f1296f1b4229d18e463cdde898fdc55b0ee31fa9 192.168.224.7:6379@16379 slave e367fb2a13e5027e657d2c7af50d462c57b14d0b 0 1594860802010 5 connected
d7ad5bbb986fb036b51e278739932fd704a91713 192.168.224.3:6379@16379 master - 0 1594860803013 2 connected 5461-10922

cluster info shows this

cluster_state:ok
cluster_slots_assigned:16384
cluster_slots_ok:16384
cluster_slots_pfail:0
cluster_slots_fail:0
cluster_known_nodes:6
cluster_size:3
cluster_current_epoch:6
cluster_my_epoch:2
cluster_stats_messages_ping_sent:6942
cluster_stats_messages_pong_sent:6817
cluster_stats_messages_meet_sent:4
cluster_stats_messages_sent:13763
cluster_stats_messages_ping_received:6815
cluster_stats_messages_pong_received:6946
cluster_stats_messages_meet_received:2
cluster_stats_messages_received:13763

NOTE:

I use docker for this. vm.overcommit_memory is set 1 in the host level

One Answer

If you use docker - it will be good idea to use bitnami-docker-redis Docker image.

See this thread How to create redis-cluster in docker based environment for details as well.

Another option: Redis replication on docker-compose

Answered by kli on December 9, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP