Thursday 31 January 2013

Howto OCFS2

OCFS2 is a POSIX-compliant shared-disk cluster file system for Linux capable of providing both high performance and high availability.  Cluster-aware applications can make use of parallel I/O for higher performance. OCFS2 is mostly used to host Oracle RAC database on Linux clusters.

The below steps shows how to create ocfs2 filesystem on top a multipath'd SAN lun and mount it on Linux clusters.

Identify the nodes that will be part of your cluster.
Export/Zone the LUNs on the SAN end and check whether they are accessible on all the hosts of the cluster. (fdisk -l or multipath -ll)
If you need multipathing, configure multipath and the multipathing policy based on your requirement. For multipath setup, refer Redhat’s multipath guide.
Create OCFS2 configuration file (/etc/ocfs2/cluster.conf) on all the cluster nodes.
The example presents you a sample cluster.conf for a 3 node pool. If you have heartbeat IP configured on these cluster nodes, use the heartbeat IP for ocfs2 cluster communication and specify the hostname (without FQDN). Copy the same file to all the hosts in the cluster.
[root@oracle-cluster-1 ~]# cat /etc/ocfs2/cluster.conf
node:
        ip_port = 7777
        ip_address = 203.21.2.101
        number = 0
        name = oracle-cluster-1
        cluster = ocfs2

node:
        ip_port = 7777
        ip_address = 203.21.2.102
        number = 1
        name = oracle-cluster-2
        cluster = ocfs2

node:
        ip_port = 7777
        ip_address = 203.21.2.103
        number = 2
        name = oracle-cluster-3
        cluster = ocfs2

cluster:
        node_count = 3
        name = ocfs2

[root@oracle-cluster-1 ~]#


On each node check the status of OCFS2 cluster service and stop "o2cb" if the service is already running.

# service o2cb status
# service o2cb stop

On each node, load the OCFS2 module.

# service o2cb load

Make the OCFS2 service online on all the nodes.

# service o2cb online

Now your OCFS2 cluster is ready.
Format the SAN device from any one of the cluster node.

# mkfs.ocfs2 -b 4k -C 32k -L oraclerac /dev/mapper/mpath0
-b : Block size (values are 512, 1K, 2K and 4K bytes per block)
-C : Cluster size (values are 4K, 8K, 16K, 32K, 64K, 128K, 256K, 512K and 1M)
-L : Label


Note : Replace /dev/mapper/mpath0 with your device name.

Update /etc/fstab on all the nodes in the cluster with the mount point.

Like : /dev/mapper/mpath0 /u01 ocfs2 _netdev 0 0

Mount the /u01 volume using mount command

# mount /u01

Enable ocfs and o2b service at runlevel 3.

# chkconfig --level 345 o2cb on ; chkconfig --level 345 ocfs2 on

The /u01 repository setup on a SAN Lun is done.
You can now configure Oracle RAC database on this filesystem.

No comments:

Post a Comment