"From scratch learning architecture" study notes Seven: high availability storage

The nature of memory availability is achieved by redundancy, which necessarily involves replication between data, the following four points is that we do the design must take into account questions:
1. How data replication
responsibilities of each node 2.
3. how to deal with replication latency
4. how to deal with interrupt copying
some of the following general scheme for the industry to do some finishing

Standby copy:

Standby advantage is simple in design, regardless of the state. Almost all of the storage systems provide standby replication strategy, shortcomings backup machine useful only when the failure of a waste of hardware costs. After the failure recovery also requires human intervention, it can not be automatically restored.

Master-slave replication:

And the difference between the active and standby unit is provided from a read operation. External provide access to services, because the machine can also provide external services then we must be certain of the monitoring data replication times, when the delay is too high, the need for human intervention to resolve.
From the master has the advantage compared with the standby:
1. copied from the master host failure, read the relevant service is not affected.
2. From the machine can also provide services, played a hardware performance
but also disadvantages, is to introduce a new complexity, mainly in the perception of the client needs to master-slave relationship, and distributed to different operating different machines for processing ( mybatis plug)

Standby switchover switchover and main memory:

There are two main and standby common problems from the program:
1. After a host failure, unable to provide writing services
2. If the host can not recover, you need to manually specify the new host role.
To achieve a complete switchover program, we need to consider the following key design points:
(1) standby state judgment:
channel state transfer is interconnected tripartite arbitration or
content of state detection, such as the machine is powered down, the process if there is, whether the response is slow, etc.
(2) switching decisions:
switching timing - backup machine or to upgrade from a host machine (three minutes to restart three times in a row, more than three seconds, and so response strategies) under what circumstances
switching policy - the original hosts back after It is made from the machine or continue switching to the host?
Auto degree - the need for manual confirmation
(3) Data Conflict Resolution:
such as primary key conflicts new data, it is necessary to analyze existing business scenarios make some deal with
common architecture
1. Internet-style


5360287-f9dad0586503dd76.jpg
Internet-style .jpg

Compared standby architecture on the basis of a multi-channel status transmission, client access to normal after the switchover, because the primary and shared between a unique IP address for the client, such as virtual IP. The main disadvantage of this strategy is reflected in the host if there is no fault, but the state channel fault, then prepare to host the opportunity to upgrade, then it may appear the case of two hosts.

2. Mediation type


5360287-3ff27f473ca1aeb4.jpg
Mediation type .jpg

The zookeeper is usually more common intermediary

3. Analog


5360287-915ef4720bc511ea.jpg
Analog .jpg

The core idea is to simulate write operations between the host machine and the apparatus to detect the status of the host, this solution is simple to implement, low cost, because it is based on HTTP state information connected relatively scarce, such as the load can not be detected cpu, i / o Load Wait.

Master-master replication

This program offers two machines literacy services, this program can cover general business processing, data can be lost, such as session, the Forum's draft data.

Data partition

Refers to partition the data according to certain rules, different partitions distributed over different geographic locations, to avoid data loss problems caused by the disaster geography. Usually the following three strategies
1. ----- Xi'an centralized backup center features extended (Beijing, Shanghai, Guangzhou) easy, high cost
2. mutual support formula - Features (Beijing, Shanghai, Guangzhou -----) design extension trouble, low cost
3. standalone features (Beijing - - Tianjin, Shanghai, Hangzhou) easy expansion, high costs

The main storage availability is how to guarantee data consistency problems. The main purpose of the algorithm is a distributed transaction in order to ensure uniform dispersion of the data submitted in multiple nodes or rollback, to meet the requirements of the ACID; and the main purpose of a distributed consensus algorithm is to ensure that the same data on multiple nodes consistency, in order to meet the requirements of the CAP CP. Understanding these algorithms can refer to "learn architecture from scratch, from paxos to zookeeper" the author wrote the study notes five: a distributed system, the basic theory of the text.

Guess you like

Origin blog.csdn.net/weixin_33694172/article/details/90988431