o2cb Utility….

Use the o2cb utility to add, remove, and list information in the cluster layout configuration file. You can also use this utility to register and unregister the cluster and to start and stop the global heartbeat. The syntax for the command is:

o2cb [–config-file=path] [-h|–help] [-v|–verbose] [-V|–version] COMMAND [ARGS]

Use the –config-file=path option to override the default configuration file, /etc/ocfs2/cluster.conf.

Available COMMAND parameters include:

  • add-cluster <cluster-name> – Adds the specified <cluster-name> to the configuration file. The configuration file can specify multiple clusters but only one cluster can be active.
  • remove-cluster <cluster-name> – Removes the specified <cluster-name> from the configuration file. This command also removes all nodes and heartbeat regions associated with the cluster.
  • add-node <cluster-name> <node-name> – Adds the specified <node-name> for the specified <cluster-name> to the configuration file. You can optionally specify an IP address [–ip <addr>], port number [–port <port>], and node number [–number <node>].
  • remove-node <cluster-name> <node-name> – Removes the specified <node-name> from the specified <cluster-name> from the configuration file
  • add-heartbeat <cluster-name> [uuid|device] – Adds a heartbeat region for the specified <cluster-name> to the configuration file
  • remove-heartbeat <cluster-name> [uuid|device] – Removes a heartbeat region for the specified <cluster-name> from the configuration file
  • heartbeat-mode <cluster-name> [local|global] – Specifies the heartbeat mode for the specified <cluster-name> in the configuration file
  • list-clusters – Lists all the cluster names in the configuration file
  • list-cluster <cluster-name> [–oneline] – Lists all the nodes and heartbeat regions associated with the specified <cluster-name> in the configuration file. The optional –oneline argument displays the output in a condensed format.
  • list-nodes <cluster-name> [–oneline] – Lists all the nodes associated with the specified <cluster-name> in the configuration file
  • list-heartbeats <cluster-name> [–oneline] – Lists all the heartbeat regions associated with the specified <cluster-name> in the configuration file
  • register-cluster <cluster-name> – Registers the specified <cluster-name> in the configuration file with configfs
    • The preceding configfs is referred to as a synthetic (or virtual) file system. This is a generic kernel component, which is also used by netconsole and fs/dlm. OCFS2 tools use it to communicate the list of nodes in the cluster, details of the heartbeat device, and cluster timeouts to the in-kernel node manager. The /sbin/o2cb.init initialization script mounts this file system at /sys/kernel/config.
  • unregister-cluster <cluster-name> – Unregisters the specified <cluster-name> from configfs
  • start-heartbeat <cluster-name> – Starts the global heartbeat on all regions for the specified <cluster-name> in the configuration file. It silently exits if global heartbeat has not been enabled.
  • stop-heartbeat <cluster-name> – Stops the global heartbeat on all regions for the specified <cluster-name>

     

Some examples of Using the o2cb Command

To create a cluster named mycluster:

# o2cb add-cluster mycluster

To add the host01 node to mycluster:

# o2cb add-node mycluster host01 –ip 192.168.1.101

To specify /dev/sda1 as a global heartbeat device:

# o2cb add-heartbeat mycluster /dev/sda1

To enable global heartbeat:

# o2cb heartbeat-mode mycluster global

To list mycluster configuration information:

# o2cb list-cluster mycluster