DRBD CentOS 7: How to Create a Distributed Replicated Block Device for Storage on Linux
- alclicconbejacra
- Aug 13, 2023
- 6 min read
The DRBD (stands for Distributed Replicated Block Device) is a distributed, flexible and versatile replicated storage solution for Linux. It mirrors the content of block devices such as hard disks, partitions, logical volumes etc. between servers. It involves a copy of data on two storage devices, such that if one fails, the data on the other can be used.
In this article, we will show how to install DRBD in CentOS and briefly demonstrate how to use it to replicate storage (partition) on two servers. This is the perfect article to get your started with using DRBD in Linux.
How To Setup DRBD To Replicate Storage On Two CentOS 7 Servers
To replicate storage, we need to add the necessary configurations in the /etc/drbd.d/global_common.conf file which contains the global and common sections of the DRBD configuration and we can define resources in .res files.
Finally, we need to test if the DRBD device will work well for replicated data storage. Remember, we used an empty disk volume, therefore we must create a filesystem on the device, and mount it, to test if we can use it for replicated data storage.
DRBD is extremely flexible and versatile, which makes it a storage replication solution suitable for adding HA to just about any application. In this article, we have shown how to install DRBD in CentOS 7 and briefly demonstrated how to use it to replicate storage. Feel free to share your thoughts with us via the feedback form below.
Is this because the drbd setup now includes 2 nodes again and has to restart the resources? We would prefer the resources remain running when the second node is included but not promoted to active, as basically that should have no influence on the already active host.
DRBD (Distributed Replicated Block Device) is a Linux-based software component to mirror or replicate individual storage devices (such as hard disks or partitions) from one node to the other(s) over a network connection. DRBD makes it possible to maintain consistency of data among multiple systems in a network. DRBD also ensures high availability (HA) for Linux applications.DRBD supports three distinct replication modes, allowing three degrees of replication synchronicity.
This tutorial walks you through the process of deploying a MySQL database to Oracle Cloud Infrastructure (OCI) by using Distributed Replicated Block Device (DRBD). DRBD is a distributed replicated storage system for the Linux platform.
DRBD software is a distributed replicated storage system for the Linux platform. It is implemented as a kernel driver, several userspace management applications, and some shell scripts.
To control the kernel driver the original DRBD user space utilities (drbdadm, drbdsetup and drbdmeta) are used. They are ported using the CygWin POSIX emulation library which is also included in the WinDRBD package (so there is no need to install CygWin alongside WinDRBD).
Each client server (drbd01 and drbd02) has three interfaces each connected to three separate networks of which only the external one, 192.168.0.0/24 is routed. The other two, 10.10.1.0/24 and 10.20.1.0/24, are private networks dedicated to the DRBD and iSCSI traffic respectively. All 4 servers are connected to the 10.20.1.0/24 network ie the storage network.
We can play with the SCST parameters to find the optimal setup for best speed, for example we can set threads_num=4 for the storage device on the fly, since we have 4 x CPUs, without stopping SCST and test its impact:
The servers: VMware workstations running OEL 7.6, 8G RAM. In addition to a 20G root device, each server has a 20G vmdk for the drbd device for the Oracle database binaries, and another 20G vmdk device for the Oracle database data files.
HA or High Availability concept for a website is becoming more common. The concept involves, setting up a cluster of computers that are always ready and has a backup when the main server goes down. Extending the possibilities in this concept, the HA Cluster is now implemented with a load balancer and failover redundancy such that, the user will never experience any hindrance of services. To implement such a complex setup in Linux, many open source technologies work in hand to achieve the result. One of the most important tasks of this implementation is keeping the file in different server sync or to attain a replica model of the file system across the servers. We will go through some of the best techniques implemented for this.
RDQM (replicated data queue manager) is a high availability way out that is existing on Linux platforms. RDQM has three servers configured in a high availability group. Each node has an instance of the Queue Manager. One instance is the running queue manager (primary node), which synchronously replicates its data to the other two instances (secondary nodes). If the server running this queue manager is unsuccessful, a different instance of the queue manager starts with the current data to operate. RDQM is supported on RHEL v7 x86-64 only.
Setting it up is pretty easy and straight forward. As this is a network file system, it is strongly recommended to setup a private switch or private network between to the servers to ensure the lowest latency, as well as better security.
Testing out changes in a production environment is never a good idea. However prepping test servers can be tedious as you have to find the hardware and setup the operating system before you can begin. So I want a faster and more cost effective medium, turning a single Cloud Server into a virtualized host server for my test servers. Welcome OpenVZ.
DRBD is meant to run in a Active / Passive setup, meaning, you can only mount the disk on one node at a time. This is not a DRBD limitation, but rather a limitation of the common file systems (ext3, ext4, xfs, etc), since they cannot account for 2 or more servers accessing a single disk.
It is recommended to wait until the initial synchronization is complete. It simply depends on the size of the block storage, and the speed of the internal network connecting the 2 servers. You can check the status by running
Microsoft Nano Server with Hyper-V role installed cannot be added to the backup infrastructure as a managed server and no role can be assigned to it. However, you can back up and replicate such servers, but application-aware processing is not supported for them.
High availability means keeping a database available at all times maintaining redundancy. Keeping two machines synchronized all the time involves various solutions. Some solutions seek to share a single disk device, mounted by two servers that can replace each other during failures or upgrades. Others opt for duplicating the machines and disks to prevent single point of failure such as SAN or other attached storage.
There are a lot of ways to do it. Some companies like to use trigger based tools but they problems with side effects such as triggers in complex schemas. The same can be said for multicast tools like PGPool. Multi-Master replication is hard, with transaction isolation and completion. Both of which are intrinsically violated in these kinds of setup, unless every single table and sequence is replicated.
MySQL Replication enables statements and data from one MySQL server instance to be replicated to another MySQL server instance. Without using more complex setups, data can only be replicated from a single master server to any number of slaves. The replication is asynchronous, so the synchronization does not take place in real time, and there is no guarantee that data from the master will have been replicated to the slaves.
Because the block device, not the data you are storing on it, is being replicated the validity of the information is more reliable than with data-only replication solutions. DRBD can also ensure data integrity by only returning from a write operation on the primary server when the data has been written to the underlying physical block device on both the primary and secondary servers.
The Distributed Replicated Block Device (DRBD) is a Linux Kernel module that constitutes a distributed storage system. You can use DRBD to share block devices between Linux servers and, in turn, share filesystems and data.
DRBD implements a block device which can be used for storage and which is replicated from a primary server to one or more secondary servers. The distributed block device is handled by the DRBD service. Writes to the DRBD block device are distributed among the servers. Each DRBD service writes the information from the DRBD block device to a local physical block device (hard disk).
Typically you use a spare partition on which the physical data will be stored . On the primary node, this disk will hold the raw data that you want replicated. On the secondary nodes, the disk will hold the data replicated to the secondary server by the DRBD service. Ideally, the size of the partition on the two DRBD servers should be identical, but this is not necessary as long as there is enough space to hold the data that you want distributed between the two servers.
You must have a spare disk or disk partition that you can use as the physical storage location for the DRBD data that will be replicated. You do not have to have a complete disk available, a partition on an existing disk is acceptable.
Remember that you must have a physical disk available for the storage of the replicated information on each DRBD node. Ideally the partitions that will be used on each node should be of an identical size, although this is not strictly necessary. Do, however, ensure that the physical partition on the DRBD secondary is at least as big as the partitions on the DRBD primary node. 2ff7e9595c
Comments