Concept and principle of DRBD based on distributed block device and its master-slave mode configuration

Source: Internet
Author: User

I. Fundamentals of DRBD

1.DRBD Basic Concepts

DRBD (full name distributed replicated block device, or DRBD) distributed block devices replication, which is plainly a data synchronization mirror between two device block levels of the same size on different nodes. DRBD is composed of kernel modules and related scripts to build a highly available cluster. The ability to use DRBD in a highly available (HA) solution can replace the use of a shared disk array storage device. Because the data exists both on the local host and on the remote host, the remote host needs to use the backup data on it to continue providing the service when it encounters the need to switch.

2.DRBD Working principle

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/73/74/wKioL1X-rwOCUvaAAAHy9Qgd4vg151.jpg "title=" QQ picture 20150920205427.png "alt=" Wkiol1x-rwocuvaaaahy9qgd4vg151.jpg "/>

From what we can clearly see is that DRBD works in a master-slave (primary/secondary) manner, which is somewhat similar to the architecture of MySQL's master-slave replication. The DRBD on the master node is promoted to primary and is responsible for receiving the write data, and when the data arrives at the DRBD module, a copy continues down to the local disk to implement data persistence, At the same time, the received data to be written is sent to the DRBD device on the local DRBD device via TCP to another host (secondary node), and the corresponding DRBD device on the other host then deposits the received data into its own disk. This is really similar to MySQL's replication based on binary log completion data, but there are some differences. For example, MySQL's slave node cannot be written but can be read, but the slave node of DRBD is unreadable and cannot be mounted.

Therefore, DRBD only allows read and write operations to the primary node at a time for the same device block, and the slave node cannot write or read. This feeling is not to host a resource waste, indeed ha architecture in order to provide redundancy is a waste of resources, but you can pair of two hosts to build two DRBD resources and master from each other, so that both machines can be used, but the configuration is complex. But then again, with DRBD as a cheap shared storage device, to save a lot of costs, because the price is much cheaper than the dedicated storage network, its performance and stability is also good.

3.DRBD Copy Mode (protocol)

Protocol A: Asynchronous replication protocol. Once the local disk write has completed and the packet is already in the Send queue, the write is considered complete. In the event of a node failure, data loss can occur because the data that is written to the remote node may still be in the sending queue. Although the data on the failover node is consistent, it is not updated in a timely manner. Therefore, this mode is the most efficient, but the data is not secure, there is data loss.

B Protocol: Memory synchronous (semi-synchronous) replication protocol. Once the local disk write is completed and the replication packet reaches the peer node, it is considered to be written on the master node as completed. Data loss can occur in the case of simultaneous failure of participating two nodes because the data in transit may not be committed to disk

C Protocol: Synchronous replication protocol. Write is considered complete only if the disk on the local and remote nodes has confirmed that the write operation is complete. There is no data loss, so this is a popular mode for cluster nodes, but I/O throughput depends on network bandwidth. Therefore, this mode data is relatively safe, but less efficient.

4.DRBD resources: Used to define a set of DRBD devices that contain the following four properties.

Resource Name: can be any acsii code character except whitespace character;
DRBD device: On both nodes, the device file of this DRBD device is generally/DEV/DRBDN, and its main device number is 147;
Disk: The storage device provided by each node on both sides;
Network configuration: The network properties used when synchronizing data between two parties;

Second, DRBD installation and configuration

1. Environment



Resources:

Introduction to DRBD, principle of operation and treatment of brain crack failure: http://bruce007.blog.51cto.com/7748327/1330959

DRBD installation configuration, how it works, and how to recover from failure: http://www.linuxidc.com/Linux/2013-09/90321.htm

Concept and principle of DRBD based on distributed block device and its master-slave mode configuration

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.