This section documents how to perform cluster administrative tasks by means of the FailSafe Cluster Manager CLI. In order to execute commands with the FailSafe Cluster Manager CLI, you should be logged in as root.
To use the cluster manager, enter either of the following:
# /usr/lib/failsafe/bin/cluster_mgr |
or
# /usr/lib/failsafe/bin/cmgr |
After you have entered this command, you should see the following message and the cluster manager CLI command prompt:
Welcome to SGI Cluster Manager Command-Line Interface cmgr> |
Once the command prompt displays, you can enter the cluster manager commands.
At any time, you can enter ? or help to bring up the CLI help display.
When you are creating or modifying a component of a Linux FailSafe system, you can enter either of the following commands:
Abort the current mode and discard any changes you have made.
Commit the current definitions or modifications and return to the cmgr prompt.
There are some Cluster Manager CLI command that you can execute directly from the command line, without entering cmgr mode, by using the -c option of the cluster_mgr command. These commands are show, delete, admin, install, start, stop, test, help, and quit. You can execute these commands directly using the following format:
cluster_mgr -c "command" |
For example, you can execute a show clusters CLI command as follows:
% /usr/lib/failsafe/bin/cluster_mgr -c "show clusters" |
1 Cluster(s) defined eagan |
The Cluster Manager CLI provides an option which displays prompts for the required inputs of administration commands that define and modify Linux FailSafe components. You can run the CLI in prompt mode in either of the following ways:
Specify a -p option when you enter the cluster_mgr (or cmgr) command, as in the following example:
# /usr/lib/failsafe/bin/cluster_mgr -p |
Execute a set prompting on command after you have brought up the CLI, as in the following example:
cmgr> set prompting on |
This method of entering prompt mode allows you to toggle in and out of prompt mode as you execute individual CLI commands. To get out of prompt mode while you are running the CLI, enter the following CLI command:
cmgr> set prompting |
For example, if you are not in the prompt mode of the CLI and you enter the following command to define a node, you will see a single prompt, as indicated:
cmgr> define node A Enter commands, when finished enter either "done" or "cancel" |
A?
At this prompt, you enter the individual node definition commands in the following format (for full information on defining nodes, see Section 5.4.1.2):
set hostname to B set nodeid to C set sysctrl_type to D set sysctrl_password to E set sysctrl_status to F set sysctrl_owner to G set sysctrl_device to H set sysctrl_owner_type to I add nic J |
Then, after you add a network interface, a prompt appears requesting the parameters for the network interface, which you enter similarly.
If you are running CLI in prompt mode, however, the display appears as follows (when you provide the appropriate inputs):
cmgr> define node A Enter commands, when finished enter either "done" or "cancel" Node Name [A]? Hostname? Node ID [0]? Sysctrl Type <chalL|msc|mmsc>? Sysctrl Password [ ]? Sysctrl Status <enabled|disabled>? Sysctrl Owner? Sysctrl Device? Sysctrl Owner Type <tty> ? Number of Controllers [2]? Controller IP Address? Controller Heartbeat HB (use network for heartbeats) <true|false>? Controller (use network for control messages) <true|false>? Controller Priority <1,2,...>? |
You can execute a series of Cluster Manager CLI commands by using the -f option of the cluster_mgr command and specifying an input file:
/usr/lib/failsafe/bin/cluster_mgr -f "input_file" |
The input file must contain Cluster Manager CLI commands and end with a quit command.
For example, the file input.file contains the following:
show clusters show nodes in cluster beta3 quit |
You can execute the following command, which will yield the indicated output:
% /usr/lib/failsafe/bin/cluster_mgr -f input.file 1 Cluster(s) defined eagan Cluster eagan has following 2 machine(s) cm1 cm2 |
The cluster_mgr command provides a -i option to be used with the -f option. This is the “ignore” option which indicates that the Cluster Manager should not exit if a command fails while executing a script.
You can use the -f option of the cluster_mgr command to write a script of Cluster Manager CLI commands that you can execute directly. The script must contain the following line as the first line of the script.
#!/usr/lib/failsafe/bin/cluster_mgr -f |
Note: When you use the -i option of the cluster_mgr command to indicate that the Cluster Manager should not exit if a command fails while executing a script, you must use the following syntax in the first line of the script file: #!/usr/lib/failsafe/bin/cluster_mgr -if. It is not necessary to use the -if syntax when using the -i option from the command line directly.
Each line of the script must be a valid cluster_mgr command line, similar to a here document. Because the Cluster Manager CLI will run through commands as if entered interactively, you must include done and quit lines to finish a multi-level command and exit out of the Cluster Manager CLI.
There are CLI template files of scripts that you can modify to configure the different components of your system. These files are located in the /usr/lib/failsafe/cmgr-templates directory. For information on CLI templates, see Section 4.3.5.
The following shows an example of a CLI command script cli.script.
% more cli.script #!/usr/lib/failsafe/bin/cluster_mgr -f show clusters show nodes in cluster beta3 quit % cli.script 1 Cluster(s) defined eagan Cluster eagan has following 2 machine(s) cm1 cm2 % |
For a complete example of a CLI command script that configures a cluster, see Section 5.8 in Chapter 5.
Template files of CLI scripts that you can modify to configure the different components of your system are located in the /usr/lib/failsafe/cmgr-templates directory.
Each template file contains list of cluster_mgr commands to create a particular object, as well as comments describing each field. The template also provides default values for optional fields.
The /usr/lib/failsafe/cmgr-templates directory contains following templates:
Table 4-1. Available Templates
File name | Description |
cmgr-create-cluster | Creation of a cluster |
cmgr-create-failover_policy | Creation of failover policy |
cmgr-create-node | Creation of node |
cmgr-create-resource_group | Creation of Resource Group |
cmgr-create-resource_type | Creation of resource type |
cmgr-create-resource-resource type | CLI script template for creation of resource of type resource type |
To create a Linux FailSafe configuration, you can concatenate multiple templates into one file and execute the resulting CLI command script.
Note: If you concatenate information from multiple template scripts to prepare your cluster configuration, you must remove the quit at the end of each template script, except for the final quit. A cluster_mgr script must have only one quit line.
For example: For a 3 node configuration with an NFS resource group containing 1 volume, 1 filesystem, 1 IP address and 1 NFS resource, you would concatenate the following files, removing the quit at the end of each template script except the last one:
3 copies of the cmgr-create-node file
1 copy of the cmgr-create-cluster file
1 copy of the cmgr-create-failover_policy file
1 copy of the cmgr-create-resource_group file
1 copy of the cmgr-create-resource-volume file
1 copy of the cmgr-create-resource-filesystem file
1 copy of the cmgr-create-resource-IP_address file
1 copy of the cmgr-create-resource-NFS file
You can invoke a shell from within the Cluster Manager CLI. Enter the following command to invoke a shell:
cmgr> sh |
To exit the shell and to return to the CLI, enter exit at the shell prompt.