Cluster Ocfs

In this howto, I will use the technology oracle ocfs.
You need to have first a shared storage between two host. This can be done with :

One thing to note, is that you cannot use a simple lvm on top of oracle ocfs. If you want to do it, you have to use cluster lvm. I still didn't use it by the way. So, at the moment of writing this article, I only did use primary simple partition of a disk or an all disk.

I will use ATA over ethernet, as it is stable on a debian Linux, server and client side. Go here to configure it.

So, first thing to do is to install the package :

# apt-get install ocfs2-tools

then mount, the necessary kernel modules to enable this cluster aware file system, so :
# /etc/init.d/o2cb load

The output will be probably something like that :
Loading module "configfs": OK
Mounting configfs filesystem at /sys/kernel/config: OK
Loading module "ocfs2_nodemanager": OK
Loading module "ocfs2_dlm": OK
Loading module "ocfs2_dlmfs": OK
Mounting ocfs2_dlmfs filesystem at /dlm: OK

Let's configure now the software.
The software need a configuration file to properly operate, but on a debian system, no file are created nor the needed directory, I don't known why anyway…
So, let's create the directory :

# mkdir /etc/ocfs2

and the needed configuration file for the software :
# touch /etc/ocfs2/cluster.conf

Now, we can create the definition of our cluster.
So, let's first define the name of our cluster :

# o2cb_ctl -C -n my_cluster -t cluster

Replace :

my_cluster

by the name that you want for the name of your cluster.
Now, I will add some node to this cluster. I put two node in this cluster, so these two nodes will be able to share the file-system and avoid any synchronization problem when they want to write something, there will be a locking mechanism that will be handled by oracle ocfs of course.

The next following step has to be done, on the two host that will be part of the cluster. It's a really important step, don't forget it, otherwise it won't properly work.
Actually, even the first step, when creating the cluster, has to be done on each host running the cluster !!
In my examples, the two host on which are running the cluster, got these ip addresses :

  • 192.168.1.120
  • 192.168.1.121

with hostname respectively of :
*proliant-ora-1-prim
*proliant-ora-1-stdb
Note, that is also really important to get the cluster properly working.

So, add the first node to the cluster, with the following syntax :

# o2cb_ctl -C -n proliant-ora-1-prim -t node -a ip_address=192.168.1.120 -a ip_port=7777 -a cluster=my_cluster -a number=1

and the second node with :

# o2cb_ctl -C -n proliant-ora-1-stdb -t node -a ip_address=192.168.1.121 -a ip_port=7777 -a cluster=my_cluster -a number=2

I underline and put in bold what has changed between these two lines, as it is really important !!
Ok, now you did one configuration on an host, let's do the same on the other.
So, I did it first on the host with ip address :

  • 192.168.1.120

and host name :

  • proliant-ora-1-prim

and then on the host with ip address :

  • 192.168.1.121

and host name :

  • proliant-ora-1-stdb

It could be done in the way you want actually, first 192.168.1.121 if you want…

We will now format with ocfs2 the new block device available from ATA over ethernet.
For me, the new block device was :

/dev/etherd/e0.0p1

so, I did this :

# mkfs.ocfs2 /dev/etherd/e0.0p1

This step need only to be done once, so not on each system…

Now, you have to enable (put online) your cluster on each host of the cluster, so simply do this :

# /etc/init.d/o2cb online my_cluster

and replace my_cluster by the name you did choose for you cluster. The output of the command will probably produces something like that :

Starting Oracle cluster my_cluster: OK

So, don't forget to run this command on each host of the cluster. Like that, he is aware that he is part of a cluster !
And now, the last step.
You only need to mount the file system on each host of the cluster.
So, let's simply do it with :
# mount.ocfs2 /dev/etherd/e0.0p1 /mnt

Again, you have to do that on each host of the cluster.

That's it, you now have your cluster file system thanks to ocfs.
Enjoy it !! In the future, I will perhaps try to do the same but with other technology, like :

If this howto needs improvements, or if there is something that doesn't seems to be clear, don't hesitate to give a comment (discuss button at bottom of the page) or even a negative feedback(bottom of the page) !!

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License