[Oracle RAC Installation]: OCFS2

For the ability to simultaneously write to 2 cluster nodes (primary/primary), you should use a cluster file system, for example ocfs2.

OCFS2 is a general-purpose cluster file system developed by Oracle specifically for clustering database files, currently available only for RHEL and OEL. It can be used to store Oracle Clusterware files, Oracle RAC datafiles, Oracle application files, or any other files. The second version of OCFS has significant changes, the innovations relate to configuring the use of datafiles and Oracle Clusterware files.

The ocfs2 file system is designed for shared use by two or more Linux systems, i.e., we have the ability to simultaneously mount partitions in RW mode on multiple nodes.

OCFS2 is freely distributed by Oracle in three RPM packages: kernel module, utility set, and graphical console. For each OS kernel version, the corresponding package should be used.

We return to the step preceding the creation of ASM disks.


Configuration is the same as in the RAC 12 iSCSI + ASM document

Server: rac1, rac2
# yum install -y \
ocfs2-tools \
ocfs2-tools-devel


If a gui console is needed, you can also install

# yum install -y \
ocfs2console


# chkconfig --level 345 o2cb on


 # mkfs.ocfs2 /dev/mapper/iscsi-disk1


# mkdir -p /u02
# mkdir -p /etc/ocfs2/


# vi /etc/ocfs2/cluster.conf


cluster:
    node_count = 2
    name = ocfs2

node:
    ip_port = 7777
    ip_address = 192.168.3.11
    number = 0
    name = rac1
    cluster = ocfs2

node:
    ip_port = 7777
    ip_address = 192.168.3.12
    number = 1
    name = rac2
    cluster = ocfs2


# /etc/init.d/o2cb offline ocfs2
# /etc/init.d/o2cb unload
# /etc/init.d/o2cb configure


// Start on both nodes

# /etc/init.d/o2cb online ocfs2

To have OCFS2 support module activated at boot, execute on each node:

# /etc/init.d/o2cb enable


# /etc/init.d/o2cb load


# /etc/init.d/o2cb status


Mounting OCFS2

For a file system containing datafiles and Oracle Clusterware files, the condition must be met that all I/O operations for files use the direct I/O mechanism (O_DIRECT). Therefore, always use the “datavolume” option when mounting the file system. Without this option, a system failure may lead to data loss.

# mount -t ocfs2 /dev/mapper/iscsi-disk1 -o datavolume /u02

Mount the OCFS2 partition to the remaining nodes.

For the file system to mount every time at boot, add to /etc/fstab on each node:

# vi /etc/fstab

/dev/mapper/iscsi-disk1 /u02 ocfs2 _netdev,datavolume,nointr 0 0

To disable periodic file system error checking, run:

/sbin/tune2fs -i 0 -c 0 /u02


Additional commands

These commands may be needed sometime:

/etc/init.d/ocfs2 restart
/etc/init.d/o2cb force-reload