Installing DRBD On Hardy!

DRBD (Distributed Replicated Block Device) is a technology that is used to replicate data over TCP/IP. It is used to build HA Clusters and it can be seen as a RAID-1 implementation over the network.

As you may all know, the DRBD kernel module has now been included into Hardy Heron Server Edition’s kernel, so there is no more source downloading and compiling, which makes it easier to install and configure. Here I’ll show you how to install and and make a simple configuration of DRBD, using one resource (testing). I’ll not cover how to install and configure heartbeat for automatic failover (This will be showed in a next post).

First of all, we will have to install Ubuntu Hardy Heron Server Edition on to servers and manually edit the partition table. We do this to leave FREE SPACE that we will be used later on as the block device for DRBD. If you’ve seen the DRBD + NFS HowTo on, creating the partitions for DRBD and leaving them unmounted will NOT work, and we won’t we able to create the resource for DRBD. This is why we leave the FREE SPACE, and we will create the partition later on, when the system is installed.

So, after the installation we will have to create the partition, or partitions (in case we are creating an external partition for the meta-data, but in this case it will be internal), that DRBD will use as a block device. For this we will use fdisk and do as follows:

fdisk /dev/sda
n (to create a new partition)
l83 (to create it as logical and format it as Filesystem # 83)
w (to write the changes)

After creating the partitions we will have to REBOOT both servers so that the kernel uses the new partition table. After reboot we have to install drbd8-utils on both servers:

sudo apt-get install drbd8-utils

Now that we have drbd8-utils installed, we can now configure /etc/drbd.conf, which we will configure a simple DRBD resource, as follows:

resource testing { # name of resources

protocol C;

on drbd1 { # first server hostname
device /dev/drbd0; # Name of DRBD device
disk /dev/sda7; # Partition to use, which was created using fdisk
address; # IP addres and port number used by drbd
meta-disk internal; # where to store metadata meta-data

on drbd2 { # second server hostname
device /dev/drbd0;
disk /dev/sda7;
meta-disk internal;

disk {
on-io-error detach;

net {
max-buffers 2048;
ko-count 4;

syncer {
rate 10M;
al-extents 257;

startup {
wfc-timeout 0;
degr-wfc-timeout 120; # 2 minutos.

Note that we are using drbd1 and drbd2 as hostnames. This hostnames must be configured and the servers should be able to ping the other via those hostnames (that means we need to have a DNS server or configure hosts for both servers in /etc/hosts).

After creating the configuration in /etc/drbd.conf, we now can create the DRBD resources. For this we issue the following in both servers:

sudo drbdadm create-md testing

After issuing this, we will be asked for confirmation to create the meta-data in the block device.

Now we have to power off both servers. After powering them off, we start our first server and we will see something similar to this:

After confirming with ‘yes’, we can now start the second server. After the second server is running. both nodes resources are secondary, so we have to make one of them primary. For this, we issue the following on the server we would like to have the resource as primary:

drbdadm -- --overwrite-data-of-peer primary all

We verify this by issuing:

cat /proc/drbd

And this should show something like this:

Well, up to this point, i’ve have showed you how to install and configure DRBD on Hardy, and how to make one of the servers have its resource as primary. But, we still don’t have automatic failover or automatic mounting. In a next post I’ll show how to configure heartbeat to have automatic failover and to take control of the resources, aswell as configuring STONITH to use the meatware device, so that we won’t have a split-brain condition (or at least try). I’ll also show how to configure NFS and MySQL to use this DRBD resource.

BTW, if you have questions you know where to find me :).


Cluster Sinchronization Tool (CSync2)

As you may know, there are many tools for file synchronization between servers that can suit your needs, but Csync2 (Website and Paper) was specially designed for Cluster File Synchronization, which makes it a great tool to synchronize config files and folders.

Now, I’ll show you a simple way of configuring it, by having a master server (where we can make changes to the config files) and one or multiple slave servers, where the files will be synchronized. First of all, we have to install it along with other packages:

:~# sudo apt-get install csync2 sqlite3 openssl xinetd

After having everything installed, we have to create the certificates that will allow Csync2 authenticate between servers so that the files can be synchronized. To do that we do this:

Read the rest of this entry »

Visual Fox Pro 6 and psqlODBC on Ubuntu with Wine

Few days ago, the Systems Adminitrator from a Financial Institution in my city asked me to make their Financial Systems work in Ubuntu. Believe it or not, they have them in VFP6, using PostgreSQL as their DBMS.

You could think it’s easy and that we just have to install VFP6 using WINE and that’s it. But that’s not the procedure I took. First of all, I changed wine to have Windows 95 as the default one. Then, I installed a VFP6 runtime (with wine) found here (_vfp6r_setup.exe). And finally, I copied the VFP98 folder, found in the Visual Studio 6.0 CD, to $HOME/.wine/drive_c/Program Files/.

After verifying that VFP6 was running OK, I installed the PostgreSQL ODBC Windows Driver. For that, I downloaded the driver from the PostgreSQL Web Site and installed it with msiexec, since it’s a *.msi file and not and *.exe (ex. msiexec /i installer.msi).

Now, after installing the PostgreSQL driver I had to decide how to create and work with DSN’s (Like in Windows). To do that, I thought i had to mess with the wine registry, but i didn’t. What i did, was to install Microsoft Data Access Components (The one used in Windows XP). I downloaded it from MS’s website (It is only available for those who have an Original Windows Copy), and installed it with wine.

After having everything was installed, it was time to create the DSN so that the VFP6 app could connect to PostgreSQL Database found in a server. To do that, I tried to open odbcad32.exe found in $HOME/.wine/drive_c/windows/system32/, but it failed. It is because wine doesn’t support the MDAC (Windows XP one) I was using, so i had to override a couple of libraries. To do that, I changed odbc32 and odbccp32 libraries, in the wine configuration, to be Native (Windows) instead of being the wine defaults.

After having all that, I just created a new DSN and copied the VFP6 app to the Ubuntu Machine and it worked flawlessly.

Peruvian LoCo Team

I’m just happy to anounce that a few minutes ago the Ubuntu Peruvian LoCo Team has been approved as an Official LoCo Team :).

In the name of the Peruvian LoCo Council (nxvl, viperhoot, P3L|C4N0, xander21c and me), I have to thank all of those who contribute and have contributed in getting the Peruvian LoCo up & running. Thanks to you all. It is because of you that we have such a great Ubuntu Peruvian Community… so Keep Contributing!!

Hello Planet Ubuntu!!

Recently, I’ve been approved by the Americas Regional Membership Board as an Official Ubuntu Member!! I just want to say that I’m really glad to become part of this great community!!.

And just for you to get to know me, I contribute in differente areas, such as:

  • the Peruvian LoCo TeAm.
  • I’m an Official Ubuntu Spanish Translator
  • I also give support on #ubuntu-pe (My nickname is RoAksoAx and you could also find me in many other #ubuntu* channels)
  • and I recently started with MOTU stuff.

I need to say that I’ve already done a couple of merges… so if anyone has suggestions on how to get started with MOTU, I’ll be more than glad to hear you!! I also want to thank effie for having such a great MOTU Journey Guide, also thank nxvl for helping me getting started with merging, and all the others who have helped me getting started on my merges, I really appreciate it :).

My First Patch – Patching alsa-tools with Quilt

Today, i’m gonna show you how i did my first patch to alsa-tools using Quilt. I have to thank crimsum who helped me a lot with this package. Actually, this is not just only a Patch… it is a merge where i had to include a Patch.

So i’m gonna show you how i did the merge first and then how I patched it. First of all I download the package as usual and checked the REPORT to see where were the conflicts.

mkdir alsa-tools
cd alsa-tools
../ alsa-tools

Read the rest of this entry »

Merging virt-viewer

Now i’m gonna show you how i merged virt-viewer 0.0.3-2 from debian unstable. The first thing to do is to create a work directory and dowload the package:

$ mkdir virt-viewer
$ cd virt-viewer
virt-viewer$ ../ virt-viewer

Read the rest of this entry »