Create OCFS2 Clustered File Systems on shared storage
Oracle Cluster File System (OCFS) presents a consistent file system image across the servers in a cluster. OCFS allows administrators to take advantage of a files system for the Oracle database files (data files, control files, and archive logs) and configuration files. This eases administration of the Oracle Real Application Clusters.
Install the ocfs2 packages
1 # apt-get install ocfs2-tools ocfs2console
Use the ocfs2console gui to create the cluster.conf for you. Your first problem may be in creating the config by hand. Even if everything looks right including the permissions to the files and directories, the ocfs2 daemons may still not see the configuration at all. I just deleted the file and used the gui to create it for me and had no problems after that.
1 # ocfs2console
First from the ocfs2 console you’ll need to create the configuration. Under “Cluster”, click on “Configure Nodes”. Add at least two node names and ip addresses. Leave the port alone, the default 7777 should be fine. If this is a dedicated private network, then it really doesn’t matter which port you use. Quit the ocfs2console application and go back to your bash console.
Stop ocfs2 and o2cb services.
12 # service ocfs2 stop# service o2cb stop
Load o2cb on all nodes before creating the file system.
1 # mkfs.ocfs2 -b 4k -C 32k -L storage -N 3 /dev/sdb1
You may find the cluster has automagically mounted at this time. If not, mount the cluster manually like this:
1 # mount.ocfs2 -o noatime,data=writeback /dev/sdb1 /mnt
Or to mount it automatically using an fstab entry add this line to /etc/fstab:
1 /dev/sdb1 /mnt ocfs2 noatime,data=writeback 0 0
That concludes a very basic setup.
Depending on what you have planned for your cluster, you may need additional file locking between nodes, or something like sanlock for running file based virtual machines to ensure multiple nodes don’t try to run the same VM at the same time.