简体   繁体   中英

how to test redis cluster

I have a Redis cluster with 3 masters. I am not interested in data persistence since this is a caching solution. I am running v3.2 on Windows. When I stop one of the servers manually to see if I can still access the db, I get 'CLUSTERDOWN The cluster is down error'. And even to do that, I have to connect to one of the instances that is still working. I don't see how this is a solution for high availability. I hope that I am missing something. Any ideas why I can't access the cluster when one of the nodes is down? Thank you.

Cluster create command:ruby.exe redis-trib.rb create 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002

As you said that you're using 3 master nodes within Redis Cluster, so it is clearly visible that if one of node will down then you'll get CLUSTERDOWN errors.

To avoid these type of errors and get high availability, its better to have slaves attached to those of your master nodes(as shown in official Redis Cluster tutorial here ).

There's a reason to have slave attached with your master to get higher availability. For that you can read these lines mentioned in above Redis cluster tutorial link.

There are 16384 hash slots in Redis Cluster, and to compute what is the hash slot of a given key, we simply take the CRC16 of the key modulo 16384.

Every node in a Redis Cluster is responsible for a subset of the hash slots, so for example you have a cluster with 3 nodes, where:

1) Node A contains hash slots from 0 to 5500.

2) Node B contains hash slots from 5501 to 11000.

3) Node C contains hash slots from 11001 to 16383.

So whenever you used to SET a Key in Redis cluster, it calculates its hash slot value for that key and save key accordingly in one of node. This is the reason it is mandatory to have all of nodes(At least master or its one slave) to be active in Redis Cluster.

Rest if you'll attach at least 1 slave with every master node into your Redis Cluster, you'll get better Redis Cluster availability. After attaching slaves with your master node, you can test your setup for higher availability by closing any of master node manually.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM