The software described in this documentation is either in Extended Support or Sustaining Support. See https://www.oracle.com/us/support/library/enterprise-linux-support-policies-069172.pdf for more information.
Oracle recommends that you upgrade the software described by this documentation as soon as possible.

22.2.4 Creating the Configuration File for the Cluster Stack

You can create the configuration file by using the o2cb command or a text editor.

Configure the cluster stack by using the o2cb command:

  1. Use the following command to create a cluster definition.

    # o2cb add-cluster cluster_name 

    For example, you would define a cluster named mycluster with four nodes as follows:

    # o2cb add-cluster mycluster

    The command creates the configuration file /etc/ocfs2/cluster.conf if it does not already exist.

  2. For each node, use the following command to define the node.

    # o2cb add-node cluster_name node_name --ip ip_address

    The name of the node must be same as the value of system's HOSTNAME that is configured in /etc/sysconfig/network. The IP address is the one that the node will use for private communication in the cluster.

    For example, to define a node named node0 with the IP address 10.1.0.100 in the cluster mycluster:

    # o2cb add-node mycluster node0 --ip 10.1.0.100

  3. If you want the cluster to use global heartbeat devices, use the following commands.

    # o2cb add-heartbeat cluster_name device1
    .
    .
    .
    # o2cb heartbeat-mode cluster_name global

    Note

    You must configure global heartbeat to use whole disk devices. You cannot configure a global heartbeat device on a disk partition.

    For example, to use /dev/sdd, /dev/sdg, and /dev/sdj as global heartbeat devices:

    # o2cb add-heartbeat mycluster /dev/sdd
    # o2cb add-heartbeat mycluster /dev/sdg
    # o2cb add-heartbeat mycluster /dev/sdj
    # o2cb heartbeat-mode mycluster global

  4. Copy the cluster configuration file /etc/ocfs2/cluster.conf to each node in the cluster.

    Note

    Any changes that you make to the cluster configuration file do not take effect until you restart the cluster stack.

The following sample configuration file /etc/ocfs2/cluster.conf defines a 4-node cluster named mycluster with a local heartbeat.

node:
	name = node0
	cluster = mycluster
	number = 0
	ip_address = 10.1.0.100
	ip_port = 7777

node:
        name = node1
        cluster = mycluster
        number = 1
        ip_address = 10.1.0.101
        ip_port = 7777

node:
        name = node2
        cluster = mycluster
        number = 2
        ip_address = 10.1.0.102
        ip_port = 7777

node:
        name = node3
        cluster = mycluster
        number = 3
        ip_address = 10.1.0.103
        ip_port = 7777

cluster:
        name = mycluster
        heartbeat_mode = local
        node_count = 4

If you configure your cluster to use a global heartbeat, the file also include entries for the global heartbeat devices.

node:
        name = node0
        cluster = mycluster
        number = 0
        ip_address = 10.1.0.100
        ip_port = 7777

node:
        name = node1
        cluster = mycluster
        number = 1
        ip_address = 10.1.0.101
        ip_port = 7777

node:
        name = node2
        cluster = mycluster
        number = 2
        ip_address = 10.1.0.102
        ip_port = 7777

node:
        name = node3
        cluster = mycluster
        number = 3
        ip_address = 10.1.0.103
        ip_port = 7777

cluster:
        name = mycluster
        heartbeat_mode = global
        node_count = 4

heartbeat:
        cluster = mycluster
        region = 7DA5015346C245E6A41AA85E2E7EA3CF

heartbeat:
        cluster = mycluster
        region = 4F9FBB0D9B6341729F21A8891B9A05BD

heartbeat:
        cluster = mycluster
        region = B423C7EEE9FC426790FC411972C91CC3

The cluster heartbeat mode is now shown as global, and the heartbeat regions are represented by the UUIDs of their block devices.

If you edit the configuration file manually, ensure that you use the following layout:

  • The cluster:, heartbeat:, and node: headings must start in the first column.

  • Each parameter entry must be indented by one tab space.

  • A blank line must separate each section that defines the cluster, a heartbeat device, or a node.