One, what is DRBD
DRBD's full name is: Distributed replicated block Device (DRBD) distributed chunk device replication, DRBD is composed of kernel modules and related scripts to build high-availability clusters. It is implemented through the network to mirror the entire device. It allows users to create a real-time mirror of a local block device on a remote machine. Used in conjunction with a heartbeat connection, you can also think of it as a network raid.
Second, how the DRBD is working
DRBD is responsible for receiving data, writing data to a local disk, and sending it to another host. The other host then saves the data to its own disk. Currently, DRBD only allows read and write access to one node at a time, which is sufficient for the common failover high-availability cluster. Future versions will support two nodes for read and write access.
Iii. the relationship between DRBD and the present HA cluster
A DRBD system is made up of more than two nodes, similar to the HA cluster, with primary and standby nodes, where applications and operating systems can run and access DRBD devices (/DEV/NBX) on nodes with major devices.
The data written by the primary node is stored in the disk device of the master node through the DRBD device. The data is also automatically sent to the appropriate DRBD device of the standby node, to the disk device that is eventually written to the standby node, and on the standby node, DRBD simply writes the data from the DRBD device to the standby node's disk device.
Most of the current high-availability clusters use shared storage, and DRBD can also serve as a shared storage device, using DRBD without any hardware investment. Because it runs in an IP network, using DRBD as a shared storage device will save a lot of costs because IP networks are more economical than dedicated storage networks in price.
Four, DRBD realization schematic diagram
DRBD is a distributed storage system in the Linux kernel's storage layer, which can be used to share block devices and share file systems and data between two Linux servers using DRBD. Similar to the functionality of a network RAID1, as shown in Figure 1:
Figure 1
V. Installation of DRDB
Download the source package from the official website to compile or directly use Yum Source to install, here take CentOS as an example to explain the installation process, other systems similar.
[Root@drbd1 ~]# Uname-a
Linux drbd1 2.6.18-194.11.1.el5 #1 SMP Tue Aug 19:09:06 EDT i686 i686 i386 gnu/linux
Install DRBD services via Yum:
[root@drbd1 ~]# yum-y Install kmod-drbd83 drbd83
Check if DRBD is installed successfully:
[Root@drbd1 ~]# Lsmod | Grep-i DRBD
DRBD 228528 3
[Root@drbd1 ~]# modprobe-l | Grep-i DRBD
/lib/modules/2.6.18-194.11.1.el5/weak-updates/drbd83/drbd.ko
After the installation is successful, there are Drbdadm,drbdmeta,drbdsetup commands under the/sbin directory, and/ETC/INIT.D/DRBD startup scripts.