Home Linux Installing and configuring a DRBD cluster in CentOS 7

Installing and configuring a DRBD cluster in CentOS 7

0
93

The backup of information is vital within a computer network, which is why fast, efficient and scalable solutions are required to meet this objective.

DRBD is a software that allows you to replicate the data of a partition between several machines. which is excellent for always having a backup of the information.

Installing DRBD

1.-Installing DRBD packages on both server

The first thing to do is to install DRDB on both nodes. To do this it is necessary to enable an external repository called ELRepo where we will download the necessary packages. We need to be root user, so open a terminal and type sudo -i, enter your password and we’ll have admin permissions.

1.- Getting root access
1.- Getting root access

Now we proceed to enable the repository:

2.- Downloading repo package
2.- Downloading repo package

We install it:

3.- Enabling additional repo
3.- Enabling additional repo

With the repository added, we can now install the DRBD packages.

4.- Installing drbd packages
4.- Installing drbd packages

After the installation of the packages is finished, make sure that the drbd module is loaded to the kernel. We do it with the following command:

5.- Checking the drbd installation
5.- Checking the drbd installation

In this case, we notice that it was not loaded, to solve this, we execute these two commands.

6.- enabling DRBD module
6.- enabling DRBD module

The first one makes the module load at the beginning of the system and the second one enables it for the active session. We proceed to check again and we’ll get:

7.- Module added
7.- Module added

2.- Configure DRBD

Once the packages are installed correctly, we must modify their configuration. First we’ll back up the original file. We will do this on both nodes:

8.- making a backup of config file
8.- making a backup of config file

Once the initial configuration file is backed up, we will create a new one:

And we’ll put the following in it:

9.- Making a new conf file
9.- Making a new conf file

Next we will create a new file for the new resource that will be drbd1 in this case. The file will be called drbd1.res.

We will add the following:

We briefly explain: disk refers to the hard disk to be replicated, device to the partition inside the disk, in the on segment comes the hostname of the computers; address to the ip address of the node and 7789 is the port where they will communicate.

10.- editing config file for the new resource
10.- editing config file for the new resource

The next step is to initialize and create the resource at each of the nodes.

11.- Creating new resource
11.- Creating new resource

Later we enable the drbd daemon on both nodes:

Now let’s define who the primary node will be, in our case it will be in “osradar”, that is, the first node.

12.- Setup primary node
12.- Setup primary node

On the second node:

In case an error occurs setting the primary node, you can use this command:

Next we must configure the firewall to accept connections through the drbd port.

Remember to modify the address in each node: if you are in node1 then in the command you must put the ip of node2.

13.- Applying firewall rules
13.- Applying firewall rules

and reboot the firewall:

14.- Firewall reload
14.- Firewall reload

We’ll have a DRBD cluster up and running, and we’ll be able to make changes to the first node’s partition and replicate from the network to the second one.

Please share this article through your social networks.

Spread the love
  • 10
    Shares

NO COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here