Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The official ruby script of Redi creates the bug of cluster double instance, three master and three slaves cluster.

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Use three virtual machines to create Redis two-instance deployment cluster three-master and three-slave cluster, and the master and slave should be crossed in pairs to avoid the situation that the master and slave are all on the same virtual machine.

This is one of our goals of building three sets of three slaves. At first, I used the ruby script redis.trib.rb on the official website to create a cluster, and then I found a big pit. No matter how you sort the cluster using the redis.trib.rb script, there will be a pair of masters and slaves that fall on the same virtual machine.

For example, the status shown below (observe the ID of the instance):

192.168.1.33:6379 192.168.1.34:6380

192.168.1.35:6379 192.168.1.35:6380

192.168.1.34:6379 192.168.1.33:6380

Cluster nodesd3cf7c72d3118f2bdd39e3581d0cc4c52e7c03c3 192.168.1.33 connected 6379 myself,master-00 1 connected 0-5460cba6c37028119adof59c589f3863716faac67721 192.168.1.34 s1ave d3cf7c72d3118f2bdd39e3581d0cc4c52e7c03c3 6380 s1ave d3cf7c72d3118f2bdd39e3581d0cc4c52e7c03c3 01543825541203 4 connectedf2336c17830c43d449cf2b6d1384b4891f9d7c2f 192.168.1.35 s1ave d3cf7c72d3118f2bdd39e3581d0cc4c52e7c03c3 6380 slave 8e6c05671c098ffa09004bd450ea5292930b2481 01543825542205 6 connected8e6c05671c098ffa09004bd450ea5292930b2481 192.168.1.356379 master-01543825540700 5 connected 10923-1638365f50d0f1117fd70278bb5d66bcb95048da8b0e5 192.168.1.34 master 6379 master-01543825541704 connected 5461-10922a12b13d5044059e7bfb95b83d8d091a626a95261 192.168.1.33 6380 s1ave 65f50d0f1117fd70278bb5d66bcb95048da8b0e5 0154382540700 3 connected

Then this is a big problem, if the 192.168.1.35 device dies, then the entire redis cluster will not be accessible, because redis cluster is a sharded storage cluster. If there are six virtual machines, this will not happen; if there are more master-slave double instance clusters, for example, if the four-master and four-slave clusters have not been tested, you can go back and test them.

To solve this problem, we can create a two-instance cluster of three masters and three slaves manually without using the official redis.trib.rb script.

-- Mark a moment

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report