NoSQL three cornerstones: cap, Base, eventual consistency
5.4.1 cap theory (hat theory):
consistency: consistency
availability: Availability
partition tolerance: partition tolerance
availability: Availability
partition tolerance: partition tolerance
The ideal goal is to design a distributed file system, while achieving three CAP nature, but it proved impossible, only two out of the three.
1) the availability of sacrifice consistency in exchange for instance:
When the situation can not be spread occurs, if p2 demand the immediate reading a copy of v2 (guarantee availability), data inconsistencies (sacrifice consistency);
If p1 p2 wait to read the data transmission over a copy of v2 (to ensure consistency), it has been a period of time (sacrificing usability);
2) Cap face problems have the following options:
CA (traditional databases: MySQL)
the CP (HBase)
the AP (Cassandra)
3) different products in different design principles theory CAP
5.4.2 BASE and eventual consistency:
全称:Basically Available, Soft state 和 Eventual consistency
ACID relational database pursuit of four properties;
NoSQL database pursuit BASE characteristics;
1)BASE:
Eventual consistency: a special case of weak consistency
There may be a period of time inconsistency, but it will eventually reach consensus.
2) eventual consistency can be divided into
:
Causal consistency:
A process notification process B, which updated a data item, B follow-up visits can get the latest value of A written. However, C and D have not been notified, it can only be access to the final, but not immediately accessible.
2. Read wrote our own consistency
3 .. monotone read consistency
4. session consistency
4. session consistency
5. monotonous write consistency
3) implement various types of consistency:
Strong consistency of minimum guarantee: R + W = N + 1
对于分布式系统来说,为了保证高可用性,比如HDFS,一般设置 副本数量N>=3
(实例)