New Cluster Registration Tool for O2CB
Sunil Mushran
May 18th, 2010
Background
o2cb_ctl is the cluster registration tool for O2CB. It is used to update the cluster configuration in cluster.conf file and register it in configfs. The problem is that the tool has a rigid user interface. At the time it was written, this was not considered a problem because users were expected to use the tool indirectly via ocfs2console(8). However, ocfs2console(8) is a GUI tool and thus requires a lot more software packages installed that are many times not available on servers running in a data-center.
Goals
The goal of this project is to develop a user-friendly o2cb cluster registration tool that has all the capabilities of o2cb_ctl. The goal is to eventually deprecate both o2cb_ctl(8) and ocfs2console(8).
O2CB
The tool's interface has been modeled after git which splits it into two levels separated by a command. The higher level takes a fixed set of optional arguments. The lower level takes arguments depending on the command. For simplicity, the lower level favors positional arguments over options.
# o2cb [--version] [--config-file=path] [--help] COMMAND [ARGS]
# o2cb [--config-file=path] [-h|--help] [-v|--verbose] [-V|--version] COMMAND [ARGS]
The --config-file points to the user-provided cluster.conf. It defaults to /etc/ocfs2/cluster.conf. This allows one to use the tool on a machine that is not part of the cluster.
The section below lists all the commands it is expected to support.
Commands
* add-cluster
Adds a cluster to the configuration file. This should be the first command given to an empty configuration file. This command will fail if the named cluster already exists.
# o2cb add-cluster <clustername>
* remove-cluster
Removes the cluster from the configuration file, including all the nodes and heartbeat regions.
# o2cb remove-cluster <clustername>
* add-node
Adds a node to the cluster in the configuration file. The command accepts optional ip, port and number. If ip is not provided, it uses the one associated with the nodename. For port, it defaults to 7777. For number, it defaults to an unused one.
# o2cb add-node [--ip <ip>] [--port <port>] [--number <num>] <clustername> <nodename>
* remove-node
Removes a node from the cluster in the configuration file.
# o2cb remove-node <clustername> <nodename>
* add-heartbeat
Adds a heartbeat region to the cluster in the configuration file. It will differentiate between the uuid and the device by the first char. '/' means device. This command will not validate the uuid. If a device is specified, it will need to have access to it inorder to lookup the uuid.
# o2cb add-heartbeat <clustername> [<uuid>|<device>]
* remove-heartbeat
Removes a heartbeat region from the cluster in the configuration file. It will differentiate between an uuid and device by the first char. '/' means device. If a device is specified, it will need to have access to it inorder to lookup the uuid.
# o2cb remove-heartbeat <clustername> [<uuid>|<device>]
* list-clusters
Lists all the cluster names in the configuration file.
# o2cb list-clusters
* list-cluster
Lists all the nodes and heartbeat regions associated with the cluster in the configuration file. The default output will be in the ini format. Optional --oneline output will be condensed.
# o2cb list-cluster [--oneline] <clustername>
* list-nodes
Lists all the nodes associated with the cluster in the configuration file. The default output will be in the ini format. Optional --oneline output will be condensed.
# o2cb list-nodes [--oneline] <clustername>
* list-heartbeats
Lists all the heartbeat regions associated with the cluster in the configuration file. The default output will be in the ini format. Optional --oneline output will be condensed.
# o2cb list-heartbeats [--oneline] <clustername>
* online-cluster
This will load the cluster configuration to configfs. This command could be called more than once to automatically add new objects into configfs. For now, we should not expect it to remove objects from configfs.
# o2cb online-cluster <clustername>
This command has been replaced by register-cluster.
* register-cluster
This will load the cluster configuration to configfs. This command could be called more than once to automatically add new objects and replace modified objects in configfs. This command can fail if the object being replaced is currently active.
# o2cb register-cluster <clustername>
* offline-cluster
This will attempt to remove all the objects in configfs. It is only an attempt because the operation can fail if the objects are pinned.
# o2cb offline-cluster <clustername>
This command has been replaced by unregister-cluster.
* unregister-cluster
This will attempt to remove all the objects in configfs. It is only an attempt because the operation can fail on pinned (active) objects.
# o2cb unregister-cluster <clustername>
* heartbeat-mode
This will toggle the heartbeat mode between global and local. This will only update the configuration. The cluster will have to be restarted for it to take effect.
# o2cb heartbeat-mode <clustername> {global|local}
* start-heartbeat
This will start global heartbeat on regions that heartbeat has not been started. It will silently exit if global heartbeat has been disabled.
# o2cb start-heartbeat <clustername>
* stop-heartbeat
This will stop global heartbeat on regions that heartbeat has been started. It will silently exit if global heartbeat has been disabled.
# o2cb stop-heartbeat <clustername>
Changes
May 20 2010, Sunil Mushran
- Initial version
Jun 21 2010, Sunil Mushran
- online/offline replace by register/unregister