Monthly Archives: January 2013

  • OCFS2 cluster – quick setup guide

    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 Real application clusters (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.
    1. Identify the nodes that will be part of your cluster.
    2. 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)
    3. If you need multipathing, configure multipath and the multipathing policy based on your requirement. For Linux multipath setup, refer Redhat’s multipath guide.
    4. Create OCFS2 configuration file (/etc/ocfs2/cluster.conf) on all the cluster nodes.
    5. 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.

      [[email protected] ~]# cat /etc/ocfs2/cluster.conf
              ip_port = 7777
              ip_address =
              number = 0
              name = oracle-cluster-1
              cluster = ocfs2

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

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

              node_count = 3
              name = ocfs2

      [[email protected] ~]#

    6. 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

    7. On each node, load the OCFS2 module.

      # service o2cb load

    8. Make the OCFS2 service online on all the nodes.

      # service o2cb online
    9. Now your OCFS2 cluster is ready.
    10. Format the SAN lun 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.
    11. Update /etc/fstab on all the nodes in the cluster with the mount point.

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

    12. Mount the /u01 volume using mount command

      # mount /u01

    13. Enable ocfs and o2b service at runlevel 3.

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

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