How to Install DRBD on Debian Latest
DRBD is an open-source software that enables mirroring of data between two nodes. This tutorial will guide you through the installation process of DRBD from http://drbd.linbit.com/ on Debian Latest.
Prerequisites
Before starting with the installation process, make sure that your Debian Latest system is up-to-date by running the following commands in your terminal:
sudo apt-get update
sudo apt-get upgrade
You will also need to have root access to your system or have sudo privileges.
Installation
Add the Linbit GPG key to your Debian system by running the following command:
wget -O - https://repo.linbit.com/linbit.gpg | sudo apt-key add -Add the Linbit repository to your system by running the following command:
echo "deb https://packages.linbit.com/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/linbit.listUpdate the package list by running the following command:
sudo apt-get updateInstall DRBD by running the following command:
sudo apt-get install drbd-utilsOnce DRBD is installed, you need to configure it. Edit the /etc/drbd.conf file using your favorite text editor:
sudo nano /etc/drbd.confYou will need to configure DRBD for your particular use case. The configuration file should have the following structure:
global { usage-count no; } common { protocol C; } resource r0 { device /dev/drbd0; on node1 { address 10.0.0.1:7788; disk /dev/sda1; meta-disk internal; } on node2 { address 10.0.0.2:7788; disk /dev/sda1; meta-disk internal; } }This configuration file creates a resource called r0 that will mirror the data on /dev/sda1 between two nodes with IP addresses 10.0.0.1 and 10.0.0.2.
Once the configuration file has been edited, you need to initialize the DRBD metadata on both nodes by running the following command:
sudo drbdadm create-md r0Finally, start the DRBD resource by running the following command:
sudo drbdadm up r0The DRBD resource should now be available on both nodes.
Conclusion
In this tutorial, you learned how to install DRBD from http://drbd.linbit.com/ on Debian Latest. You also learned how to configure and start a DRBD resource. With this knowledge, you can build highly available clusters that are resilient to data loss.