Configuring your cluster to support OCFS2

Creating the configuration file

OCFS2 uses a central configuration file, /etc/ocfs2/cluster.conf.

When creating your OCFS2 cluster, be sure to add both your hosts to the cluster configuration. The default port (7777) is usually an acceptable choice for cluster interconnect communications. If you choose any other port number, be sure to choose one that does not clash with an existing port used by DRBD (or any other configured TCP/IP).

If you feel less than comfortable editing the cluster.conf file directly, you may also use the ocfs2console graphical configuration utility which is usually more convenient. Regardless of the approach you selected, your /etc/ocfs2/cluster.conf file contents should look roughly like this:

node:
    ip_port = 7777
    ip_address = 10.1.1.31
    number = 0
    name = alice
    cluster = ocfs2

node:
    ip_port = 7777
    ip_address = 10.1.1.32
    number = 1
    name = bob
    cluster = ocfs2

cluster:
    node_count = 2
    name = ocfs2

When you have configured you cluster configuration, use scp to distribute the configuration to both nodes in the cluster.

Configuring the O2CB driver

  • SUSE Linux Enterprise systems. On SLES, you may utilize the configure option of the o2cb init script:

    /etc/init.d/o2cb configure
    Configuring the O2CB driver.
    
    This will configure the on-boot properties of the O2CB driver.
    The following questions will determine whether the driver is loaded on
    boot.  The current values will be shown in brackets ('[]').  Hitting
    <ENTER> without typing an answer will keep that current value.  Ctrl-C
    will abort.
    
    Load O2CB driver on boot (y/n) [y]:
    Cluster to start on boot (Enter "none" to clear) [ocfs2]:
    Specify heartbeat dead threshold (>=7) [31]:
    Specify network idle timeout in ms (>=5000) [30000]:
    Specify network keepalive delay in ms (>=1000) [2000]:
    Specify network reconnect delay in ms (>=2000) [2000]:
    Use user-space driven heartbeat? (y/n) [n]:
    Writing O2CB configuration: OK
    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
    Starting O2CB cluster ocfs2: OK

  • Debian GNU/Linux systems. On Debian, the configure option to /etc/init.d/o2cb is not available. Instead, reconfigure the ocfs2-tools package to enable the driver:

    dpkg-reconfigure -p medium -f readline ocfs2-tools
    Configuring ocfs2-tools
    -----------------------
    Would you like to start an OCFS2 cluster (O2CB) at boot time? yes
    Name of the cluster to start at boot time: ocfs2
    The O2CB heartbeat threshold sets up the maximum time in seconds that a node
    awaits for an I/O operation. After it, the node "fences" itself, and you will
    probably see a crash.
    
    It is calculated as the result of: (threshold - 1) x 2.
    
    Its default value is 31 (60 seconds).
    
    Raise it if you have slow disks and/or crashes with kernel messages like:
    
    o2hb_write_timeout: 164 ERROR: heartbeat write timeout to device XXXX after NNNN
    milliseconds
    O2CB Heartbeat threshold: 31
    		Loading filesystem "configfs": OK
    Mounting configfs filesystem at /sys/kernel/config: OK
    Loading stack plugin "o2cb": OK
    Loading filesystem "ocfs2_dlmfs": OK
    Mounting ocfs2_dlmfs filesystem at /dlm: OK
    Setting cluster stack "o2cb": OK
    Starting O2CB cluster ocfs2: OK