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

What are the advantages and advantages of Redis cluster model

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly explains "what are the advantages and advantages of Redis cluster model". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what are the advantages of Redis cluster model"?

Stand-alone mode

Redis in stand-alone mode is very simple, you only need to start a single node, and the installation process does not take more than 5 minutes.

Through the redis-benchmark test of simple commands, QPS can reach more than 10w, I have to say very amazing.

The problem of stand-alone mode is also very obvious. Lack of highly available mechanisms!

If the redis process dies, the process can only penetrate into the underlying database, which is very dangerous for the business. If you use redis as a data store, the situation will become more serious and even lose data.

Master-slave mode

So the most basic redis deployment adds one or more slave (now called replication).

When there is a problem with the main redis, you can select a slave to top it.

Unfortunately, this mode is the same as the traditional MySQL master-slave mode, which is painful to switch, and requires the help of external tools, such as keepalived, which directly increases the difficulty of deployment and maintenance.

Keepalived is a high availability scheme based on VRRP protocol, which is realized by IP drift. It can be seen from the description that it requires the participation of network administrators, which runs counter to our lightweight redis.

Sentinel mode

Sentinel mode is to use additional processes to replace the function of keepalived to judge the viability of redis processes. In Sentinel mode, once the master node is down, the backup of the slave node as the master node can be topped up at any time.

But one of the biggest problems with the Sentinel mode is that there are too many Sentinels, requiring at least three nodes.

When arbitrating the redis, it needs a vote of two nodes to confirm it, which is also the common practice of distributed systems (quorum). Similar to Zookeeper, it is very appropriate to have an odd number of sentinel nodes.

Sentinel mode can be used to detect multiple clusters at the same time through sentinel monitor configuration, which is easy to use when the number of clusters is moderate.

But Sentinel mode has many hidden holes, such as Sentinel startup, which can only work properly while master is alive; in addition, Sentinel cannot start if you use RENAME in your redis configuration file to block some dangerous commands.

When the client connects to redis, it can no longer directly connect to the instance of redis. It needs to turn around from the Sentinel to get some change information.

Cluster mode

Cluster mode is arguably the most elegant way to do this. You only need to deploy multiple peer redis nodes, and then use client commands to group them.

Ip=192.169.0.23./bin/redis-cli-- cluster create $ip:7001$ ip:7002$ ip:7003$ ip:7004$ ip:7005$ ip:7006-- cluster-replicas 1

It also has more requirements for nodes, generally using 6 nodes, three masters and three slaves. When there are more than 10 nodes, its coordination is not so flexible, so the storage and performance limit of a single cluster can be reached quickly.

Some of the shortcomings of the cluster model are hidden. Its server nodes are very stable, but some commands can seriously affect performance. Such as mget,pipeline and so on. They need to distribute requests to multiple nodes for execution and re-aggregation. The more nodes, the lower the performance.

At this point, I believe you have a deeper understanding of "what are the advantages and advantages of Redis cluster model?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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

Development

Wechat

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

12
Report