In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
What are the three modes of Redis? Many people may not have an in-depth understanding of this, so the editor summarized this article, through the explanation of this article, I hope you can gain more knowledge.
Standaloan (stand-alone mode)
Standaloan is a redis stand-alone mode, and all services are connected to a redis service, this mode is not suitable for production. If downtime occurs and memory explodes, it may cause cache invalidation of all services connected to redis and cause an avalanche.
Ssentinel (Sentinel Mode)
Redis-Sentinel (Sentinel Mode) is a high availability (HA) solution officially recommended by Redis. When Redis is used as a high availability solution for Master-slave, if master goes down, Redis itself (including many of its clients) does not automatically switch between active and standby, and Redis-sentinel itself is also an independent process, which can monitor multiple master-slave clusters and switch when master is down.
Sentinel Sentinel implements the following functions
(1) monitoring: monitor whether redis is running properly
(2) notification: notify application of error message
(3) failover: when a master dies, select another slave to upgrade to master and update the master-slave relationship.
(4) configurationprovider:client obtains the redis address through sentinel and updates the address when failover
2. Sentinels and slaves autodiscovery (redis2.8 and above)
Only master addresses are configured in the configuration file, and slave addresses and sentinel addresses can be discovered automatically.
(1) the exchange of information between sentinels--sentinel is obtained by redis pub/sub.
(2) slaves-- asked master to obtain.
3 、 sdown 、 odown 、 failover
Fault detection is generally through the ping-pong mechanism, and sentinel introduces sdown (subjective offline) and odown (objective offline) mechanisms. The purpose should be to detect more objectively when the cluster size is large.
(1) ping-pong failed within sdwon--is-master-down-after-milliseconds (configurable) time. Slave for sdown cannot be upgraded to master.
(2) sentinel with more than a certain number of odown-- (configurable) think that sdown,odown is only for master.
(3) most sentinel of failover-- think odown.
Redis-cluster (Cluster Mode)
Redis cluster mode can also achieve redis high availability deployment. In Redis Sentinel cluster mode, with the increase of business and data volume, the performance reaches the bottleneck of redis single node, vertical expansion is limited by machines, horizontal expansion involves the impact on applications and the risk of data loss in data migration. In view of these pain points
Redis3.0 proposes cluster distributed cluster solution. When it comes to single node memory, concurrency, and traffic bottleneck, cluster scheme is adopted to achieve load balancing. Cluster scheme mainly solves the problem of slicing, that is, the whole data is divided into multiple subsets according to rules and stored on multiple different points, and each node is responsible for a part of its own data.
Redis Cluster uses the virtual slot partition in the hash partition rule. Virtual slot partition skillfully uses hash space, using well-dispersed hash functions to map all data to a fixed range of integers, which are defined as slots (slot). The range of Redis Cluster slots is 0 ~ 16383. Slot is the basic unit of data management and migration in the cluster.
The main purpose of using large-scale slots is to facilitate the splitting of data and the expansion of clusters, and each node is responsible for a certain number of slots. Redis Cluster uses virtual slot partition, and all keys are mapped to 0 ~ 16383 according to the hash function. The formula is slot = CRC16 (key) & 16383. Each real node is responsible for maintaining part of the slot and the key value data mapped by the slot. The following figure shows a cluster of five nodes, each node is responsible for about 3276 slots on average, and the process of mapping to the corresponding slots of the corresponding node through the calculation formula.
Redis-cluster architecture diagram
This is the end of the three modes of Redis. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.