Monday, September 9, 2013

Exer 6 (Part II): DRBD Set-up

For this exercise, we were tasked to install and configure DRBD on two computers which will act as servers. Here are the steps we did:

1. Using GParted, we created a new partition with unknown file system type.



 2.  We installed drbd using apt-get install drbd8-utils.
 3. We loaded its kernel module, then backed up the drbd configuration file and created a new one on both servers.



4. We then initialized the meta data storage and started DRBD on both servers/nodes.

5. We made the server 1 as our primary node using drbdadm -- --overwrite-data-of-peer primary all.
6. On server 2, we used cat  /proc/drbd to see some progress on synchronization.
7. Then on server 1, we also used cat  /proc/drbd. This was the output:

8. Also on server 1 (only), we created an ext4system filesystem and a directory (named data) then mounted the filesystem on that directory:
mkfs.ext4 /dev/drbd0
mkdir /data
mount /dev/drbd2/data

To checked if it was mounted, we used the command mount and df -h.



9. To test the configuration we made, we created files on the /data directory and checked if they were replicated to server 2.
10. We unmounted the /data directory on server1 then assigned the secondary role to it: drbdadm secondary r0. 
11. We assigned the primary role to server 2: drbdadm primary r0 and checked the output of cat /proc/drbd to know if it was the primary server. Then a directory /data was created and /dev/drbd2 was mounted on it.
12. We checked the contents of the data directory. The files that we created on server 1 were there.


It took us almost three hours to do this exercise successfully. We repeated some steps more than once because of some errors that appeared. There were times that we needed to restart our computers. But all of our efforts paid off.

References:
http://www.howtoforge.com/setting-up-network-raid1-with-drbd-on-ubuntu-11.10

Exer 6 (Part I): Intro on DRBD + Making a Dynamic Website

I. DRBD

DRBD or Distributed Replicated Block Device refers to block devices designed as a building block to form high availability (HA) clusters. - drbd.org

It can be used as the basis of:

  • Conventional and shared disk file systems
  • another logical blocking device
  • applications which require direct access to a blocking device
-Wikipedia


Do visit drbd.org to learn more on DRBD. Also, please read my succeeding entries about installation and configuration of DRBD, and integration of it with Heartbeat.

II. Dynamic Website

After reading on DRBD, we created a dynamic website using PHP and mySQL. This website will be used for DRBD on the next parts of this exercise.

First, we installed all the applications that we needed:
  • apache2
  • php5
  • mysql

Then, we made a database of users. It has only one table named user with column names username and password.


There are four functionalities /parts for this website: add user/sign up, log in, edit account, delete account.
Here are some screenshots of the website. Unfortunately, we lost the other screenshots.