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

Redis cluster

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

Share

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

Basic introduction of Redis Cluster

A Redis cluster is a facility installation that can share data among multiple Redis nodes.

Redis clusters do not support Redis commands that need to process multiple keys at the same time, because executing these commands requires moving data between multiple Redis nodes, and in high load situations, these commands degrade the performance of the Redis cluster and lead to unpredictable behavior.

Redis clusters provide a certain degree of availability availability by partitioning partition: even if some nodes in the cluster fail or are unable to communicate, the cluster can continue to process command requests.

Redis clustering provides the following two benefits:

The ability to automatically split data into multiple nodes by split.

The ability to continue to process command requests when some nodes in the cluster fail or are unable to communicate.

Principle of Cluster redis-cluster Architecture Diagram

All redis nodes are interconnected with each other (PING-PONG mechanism), and binary protocols are used internally to optimize transmission speed and bandwidth.

The fail of a node takes effect only when it is detected by more than half of the nodes in the cluster.

The client is directly connected to the redis node and does not require 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.

Redis-cluster maps all physical nodes to [0-16383] slot, and cluster is responsible for maintaining nodeslotvalue

There are 16384 hash slots built into the 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 for 16384, so that each key corresponds to a hash slot numbered between 0 and 16383. Redis will map the hash slot to different nodes according to the number of nodes.

Redis-cluster voting: fault tolerance

In the voting process, all master in the cluster participate. If more than half of the master nodes time out to communicate with the master nodes (cluster-node-timeout), the current master nodes are considered to be dead.

When is the entire cluster unavailable (cluster_state:fail)?

Redis-3.0.0.rc1 adds the cluster-require-full-coverage parameter, which is disabled by default, but failed to open the cluster compatibility part.

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.

If more than half of the cluster master is down, with or without slave, the cluster will enter the fail state.

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