4.3. Using the FailSafe Cluster Manager CLI

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:

cancel

Abort the current mode and discard any changes you have made.

done

Commit the current definitions or modifications and return to the cmgr prompt.

4.3.1. Entering CLI Commands Directly

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

4.3.2. Invoking the Cluster Manager CLI in Prompt Mode

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:

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,...>? 

4.3.3. Using Input Files of CLI Commands

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.

4.3.4. CLI Command Scripts

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.

4.3.5. CLI Template Scripts

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:

4.3.6. Invoking a Shell from within CLI

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.