In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "what is the function of Redis distributed cache". In daily operation, I believe that many people have doubts about the role of Redis distributed cache. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "what is the role of Redis distributed cache?" Next, please follow the editor to study!
Redis Sentinel mode
The method of master-slave switching technology is: when the master server is down, you need to manually switch a slave server to the master server, which requires manual intervention, laborious and laborious, and will cause the service to be unavailable for a period of time. This is not a recommended approach, and more often, we give priority to Sentinel mode.
I. Overview of Sentinel Model
Sentinel mode is a special mode. First of all, Redis provides the command of Sentinel. Sentinel is a separate process, which runs independently as a process. The principle is that the sentry monitors multiple Redis instances running by sending commands and waiting for the Redis server to respond.
The sentinels here serve two purposes.
Send a command to get the Redis server back to monitor its running status, including the master server and the slave server.
When the sentry detects a master outage, it automatically switches slave to master, then notifies other slave servers through publish-subscribe mode and modifies the configuration file to switch hosts.
However, there may be problems when a sentinel process monitors the Redis server, so we can use multiple sentinels to monitor it. There is also monitoring between sentinels, which forms a multi-sentinel mode.
Describe the failover (failover) process in words. Assuming that the primary server is down, Sentinel 1 first detects this result, the system will not immediately carry out the failover process, only Sentinel 1 subjectively thinks that the primary server is unavailable, this phenomenon becomes subjective offline. When the subsequent sentinel also detects that the primary server is unavailable and the number reaches a certain value, then a vote will be conducted between the sentinels, and the result of the vote will be initiated by a sentry for failover operation. After the switch is successful, each sentry will switch hosts from the server monitored by himself through the publish and subscribe mode. This process is called objective offline. This way, everything is transparent to the client.
II. Redis configuration Sentinel mode
III. Other configuration items of the Sentinel mode
The sentinel down-after-milliseconds configuration item is just a sentry who thinks the host is unavailable after a specified period of time and still does not get a response. For other sentinels, this is not the case. The Sentinel will record this message, and when the number of Sentinels with subjective downlines reaches the number configured by sentinel monitor, it will initiate a vote for failover, and the Sentinel will rewrite the Sentinel profile of Redis to meet the needs of the new scene.
Redis Cluster principle 1.1.Redis-cluster Architecture Diagram
1. All redis nodes are interconnected with each other (PING-PONG mechanism), and binary protocol is used internally to optimize transmission speed and bandwidth.
2. The fail of a node takes effect only when it is detected by more than half of the nodes in the cluster.
3. The client is directly connected to the redis node and does not need an intermediate proxy layer. The client does not need to connect to all the nodes in the cluster, but to any of the available nodes in the cluster.
4. Redis-cluster maps all physical nodes to [0-16383] slot. Cluster is responsible for maintaining 16384 hash slots built into the nodeslotvalue Redis cluster. When you need to place a key-value in the Redis cluster, redis first uses the crc16 algorithm to calculate a result for the key, and then calculates the remainder of the result to 16384, so that each key corresponds to a hash slot numbered between 0 and 16383. Redis maps hash slots to different nodes roughly equally based on the number of nodes. One node corresponds to one redis server. 16384 hash slots can correspond to up to 16384 redis servers.
1.2.Redis-cluster Voting & Fault tolerance
During the voting process, all master in the cluster participate. If more than half of the master nodes time out to communicate with the master node (cluster-node-timeout), the current master node is considered to be dead.
When is the entire cluster unavailable (cluster_state:fail)?
A: if any master of the cluster is down, and the current master has no slave. When a cluster enters the fail state, it can also be understood as entering the fail state when the cluster's slot mapping [0-16383] is incomplete. Ps: redis-3.0.0.rc1 is added to the cluster-require-full-coverage parameter, which is disabled by default, but failed to enable the cluster compatibility part.
B: if more than half of the cluster master is down, regardless of whether there is slave or not, the cluster will enter the fail state.
At this point, the study on "what is the role of Redis distributed cache" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.