A strong consistency storage scheme based on quorum mechanism

Source: Internet
Author: User

When an online build environment provides data services with a single server, we worry that the server is down, that the service is unavailable, or that data is lost, and that we typically store data redundantly to ensure high availability of data services.

But adding more machines will bring about data consistency, let's look at a strong consistent storage scheme based on the quorum mechanism.

Three machine quorum mechanism

Quorum, the majority principle, is similar to voting, and is passed by a majority of the agreed action.

This paper discusses the quorum mechanism based on three machines, which we call a-machine, B-Machine and C-machine. Where a, B machine for data storage, called the data machine. When the write request falls to a, whether the data can be actually written, at least to obtain the approval of B or C machine, when the request fell to a, B machine, then need a third-party arbitration, this is the role of C machine.

Read and write operations need to be on the latest data, in order to identify which computer data on the latest, we introduce the version number, each data record, not only the data itself, but also store the corresponding version of the computer and another data machine information:

When the Vera = verb on each machine, the data of each machine is considered to be the same and the latest data, when Vera > verb, the data on a machine is considered up to date. In practical application, the data and version information are maintained by proposing, negotiating, synchronizing and broadcasting, and the data is written to a machine as an example, we look at the specific writing process.

Proposals and consultations

A write request to a key falls to a machine and will undergo the following process:

    1. First, a check key corresponding version number, when satisfied with Vera >= verb, the data written to a machine request to get their own pass, and to B machine, C machine send a request to ask whether can write (proposed)
    2. b Machine (c machine) Check the local key corresponding version number, also meet Vera >= verb, tell a machine can write (negotiate)
    3. A machine to get B or C machine through, you can write data, while upgrading the corresponding version number of the machine key Vera

After the above steps, the key on a machine on the corresponding data on the B machine inconsistency, and on each machine Vera > VerB. Further, we update the B-machine, C-machine information by synchronizing and broadcasting.

Sync and broadcast

A machine data update, the B machine will be synchronized data, B machine after the completion of the data update will promote the version number, will also be synchronized to a machine, C machine, the specific process is as follows:

    1. b Check the local key corresponding version number, when the VerA > verb is satisfied, allow synchronous data to write to local, promote verb, when verA = verb, by the C machine quorum, C.vera > C.verb, the same allows data to write to local, elevation verb, Otherwise, the error is returned (synchronous)
    2. After the success of the update, B broadcasts its own version number, A.verb, C.verb will be promoted, then three machines to restore the balance State (broadcast)

The diagram for synchronization and broadcast is as follows:

Read process

Three machine quorum reading process is simpler than the writing process, but there is also an inquiry process, as follows:

    1. When a read request falls to a, an error is returned if A.vera < B.verb
    2. If A.vera >= B.verb, also need to ask B, C machine, whether agree VerA is up-to-date, the latest return data


Three machine quorum provides two data machine storage redundancy implementation scheme, once write operation, reads will obtain the newest data, therefore it conforms to the strong consistency. The quorum mechanism can also be extended, such as 3 data-machine +5-version machines, to meet additional data redundancy storage requirements.

A strong consistency storage scheme based on quorum mechanism

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.