Recently collated Redis, a deeper understanding of Sentinel, specifically summarized as follows
1. master-Slave Redis
Master-Slave Redis is actually a primary standby mode that allows you to switch from Redis to service after the master Redis outage.
Disadvantages:
1. People pay attention to whether Master is down
2. Unable to complete auto switch master/slave
3. The function of the slave node is not fully utilized
Master-Slave Mode:
2.sentinel
To address this determination, Redis officially provides Sentinel to ensure high availability of Redis
Figure 1 shows the relationship between Sentinel and Redis, where the Sentinel system creates two links for each Redis instance (master, slave): Command connection, subscription connection
Command connection: Send info command to keep communication with Redis
Subscribe to connections: Automatically discover other Sentinel instances by subscribing to a connection
Figure 2 shows a minimal sentinel, which is comprised of at least three sentinel instances, and when the monitored Redis is judged to be the supervisor downline, it is necessary to elect a minor sentinel from Sentinel for master-slave switchover.
Advantages:
1.SENTIENL can monitor the health status of master-slave node, reduce the cost of human monitoring
2.sentinel can complete master-slave switching
Disadvantages:
1. From the node is still not fully utilized
2. Unable to scale out, only one master of the server is available
Sentinel Mode:
Figure 1
Figure 2
3. sharding
The idea of sharding is to achieve the scale-out of Redis by using the consistent hashing algorithm.
1. Storage of Sentinel configuration information via zookeeper
2. Implement a consistent hashing algorithm on the client, which determines that the Redis command is executed by the Redis instance through the routing algorithm
3. To share the pressure of a single shard by increasing shard
Disadvantages:
1. Data migration is involved in the expansion, if the Redis is only cached data is easy to handle, but if there is a strong reliance on Redis business data, the migration can only stop processing
2. Unable to solve hot and cold data problems
Shard Mode:
The following sections focus on:
Jedisclient the implementation principle of the customer list
Redis High-availability evolution