当前位置:网站首页>Redis highly available

Redis highly available

2022-06-24 15:10:00 Quinlan

Stand-alone version

characteristic : Simple

problem :

1、 Memory capacity is limited 2、 Limited processing capacity 3、 No high availability .

Master slave copy

Redis Copy (replication) The feature allows the user to follow one Redis Server to create any number of replicas of that server , Where the replicated server is the primary server (master), A server replica created by replication is a slave server (slave). As long as the network connection between the master and slave servers is working , Both master and slave servers will have the same data , The master server will always synchronize the updates that are happening to it To the slave server , This ensures that the master and slave servers always have the same data .

characteristic :

1、master/slave role

2、master/slave Same data

3、 Reduce master Reading pressure is transferring from the library

problem :

There is no guarantee of high availability

No solution master The pressure of writing

sentry

Redis sentinel It's monitoring in a distributed system redis Master slave server , And automatically fail over when the primary server is offline . Three of them :

monitor (Monitoring):    Sentinel  Constantly check whether your master and slave servers are working properly .

remind (Notification): When someone is being monitored Redis When there's a problem with the server , Sentinel Can pass API Send notifications to administrators or other applications .

Automatic failover (Automatic failover): When a primary server doesn't work , Sentinel An automatic failover operation will start .

characteristic :

1、 Guaranteed high availability

2、 Monitor each node

3、 Automatic failover

shortcoming : A master-slave mode , Switching takes time to lose data

No solution master The pressure of writing

colony (proxy type ):

Twemproxy It's a Twitter Open source redis and memcache Fast / Lightweight proxy server ; Twemproxy Is a fast single threaded agent , Support Memcached ASCII The protocol and redis agreement .

characteristic :1、 Varied hash Algorithm :MD5、CRC16、CRC32、CRC32a、hsieh、murmur、Jenkins 

2、 Support automatic deletion of failed nodes

3、 Back end Sharding Sharding logic is transparent to business , The business side's reading and writing mode and operation are single Redis Agreement

shortcoming : Added a new proxy, Need to maintain its high availability .

failover Logic needs to be realized by itself , It can't support the automatic transfer of failure and has poor scalability , Manual intervention is required for expansion and contraction

colony ( Direct connected type ):

from redis 3.0 Later versions support redis-cluster colony ,Redis-Cluster Use a no center structure , Each node holds the data and the entire cluster state , Each node is connected to all other nodes .

characteristic :

1、 No central Architecture ( There is no node that affects the performance bottleneck ), Less proxy layer .

2、 Data according to slot Storage is distributed over multiple nodes , Data sharing between nodes , Data distribution can be adjusted dynamically .

3、 Extensibility , It can be linearly extended to 1000 Nodes , Nodes can be added or removed dynamically .

4、 High availability , Some nodes are not available , The cluster is still available . By increasing the Slave Make a backup copy of the data

5、 Realize automatic fault diagnosis failover, Nodes pass through gossip Protocol exchanges status information , By voting Slave To Master The role of .

shortcoming :

1、 Poor resource isolation , It is easy to interact with each other .

2、 Data is replicated asynchronously , Strong consistency of data is not guaranteed

原网站

版权声明
本文为[Quinlan]所创,转载请带上原文链接,感谢
https://yzsam.com/2021/05/20210522180817479o.html