You can run the commands sequentially at one database partition after another or you can run the commands in parallel. If you run the commands in parallel, you can either choose to have the output sent to a buffer and collected for display (the default behaviour) or the output can be displayed at the node where the command is issued.
To use rah, type:
rah command
To use db2_all, type:
db2_all command
To get help on rah syntax, type
rah "?"
The command is run using rshell to send the command to each host. The command can be almost anything which you could type at an interactive shell prompt, including, for example, multiple commands to be run in sequence. You separate multiple commands using a semicolon (;). Do not use the semicolon following the last command.
The following example shows how to use the db2_all command to load data on several partitions specified in the db2nodes.cfg file. Because a semicolon was placed inside the double quotes, the request will run concurrently. The messages from the load command will be sent back to the partitions where the db2_all command is run. The output messages will be placed into an output file called load.test1.out.
db2_all ";$HOME/load.test1" |tee load.test1.out
The following commands should be defined as synonyms for rah.
These commands execute rah with certain implicit settings such as:
You may specify the command:
You should use the prompt method if the command contains the following special characters:
| & ; < > ( ) ` { } [ ] unsubstituted $The command will be added to your shell history just as if you typed it at the shell prompt. If you specify the command as the parameter on the command-line, you must enclose it in double-quotes if it contains any of the special characters just listed.
All special characters in the command can be entered normally (without being enclosed in quotes except for \). If you need to include a \ in your command, you must type two backslashes (\\).
Note: | For non-ksh users, all special characters in the command can be entered normally (without being enclosed in quotes except for ` " \ unsubstituted $, and the single-quote (')). If you need to include one of these characters in your command, you must precede them by three backslashes (\\\). For example, if you need to include a \ in your command, you must type four backslashes (\\\\). |
If you need to include a double quote (") in your command, you must precede it by three backslashes, for example, \\\". You cannot include a single-quote (') in your command unless your shell provides some way of entering a single-quote inside a singly-quoted string.
By default, the command is run sequentially at each host, but you can specify to run the commands in parallel using background rshells by prefixing the command with certain prefix sequences. If the rshell is run in the background then each command puts the output in a buffer file at its remote host. This process retrieves the output in two pieces:
The name of the buffer file is /tmp/$USER/rahout by default, but it can be specified by the environment variables $RAHBUFDIR/$RAHBUFNAME.
When you specify that you want the commands to be run concurrently, by default, this script prepends an additional command to the command sent to all hosts to check that $RAHBUFDIR and $RAHBUFNAME are usable for the buffer file. It creates $RAHBUFDIR. To suppress this, export an environment variable RAHCHECKBUF="no". You can do this to save time if you know the directory exists and is usable.
Before using rah to run a command concurrently at multiple hosts, ensure that:
rah ")mkdir /tmp/$USER"
export RAHCHECKBUF=no
While any remote commands are still running or buffered output is still being accumulated, processes started by rah monitor activity to:
The informative messages are written at an interval controlled by the environment variable RAHWAITTIME. See the help information for details on on how specify this. All informative messages can be completely suppressed by exporting RAHWAITTIME=0.
The primary monitoring process is a command whose command-name (as shown by ps command) is rahwait>or. The first informative message tells you the pid (process id) of this process. All other monitoring processes will appear as ksh commands running the rah script (or name of symbolic link). If you wish, you can stop all monitoring processes by the command:
kill <pid>where <pid> is the process id of the primary monitoring process. Do not specify a signal number. Leave the default of 15. This will not affect the remote commands at all, but will prevent automatic display of buffered output. Note that there may be two or more different sets of monitoring processes executing at different times during the life of a single execution of rah. However, if at any time you stop the current set, then no more will be started.
If your regular login shell is not a kornshell (for example /bin/ksh), you can use rah but there are some slightly different rules on how to enter commands containing the following special characters:
" ` unsubstituted $ 'For more information, type rah "?". Also, in a UNIX-based environment, if the login shell at the id which executes the remote commands is not a kornshell, then the login shell at the id which executes rah must also not be a kornshell. (rah makes the decision as to whether the remote id's shell is a kornshell based on the local id). The shell must not perform any substitution or special processing on a string enclosed in single quote marks. It must leave it exactly as is.