Performing Health Checks on Domain and Database Status
Periodically, you may want to confirm the state of a specific Admin Process (AP) or database, or a specific Storage Manager (SM) process or Transaction Engine (TE) process.
Invocations of the nuocmd check commands documented here exit with exit code 0 if the nuocmd check condition is successful and generate no output.
The commands will exit with exit code 1 if the check condition is unsuccessful and generate an error message describing what failed.
To display the nuocmd check command return value, after running the command, type echo $? at the Linux prompt.
The following commands provide information on the number of processes and their status:
nuocmd check database --db-name <database name>-
Subcommand Description --check-liveness nChecks that all processes have responded within the specified number (
n) of seconds.--check-runningChecks whether the database is in the
RUNNINGstate.--num-processes nChecks the number of processes.
nuocmd check servers-
Subcommand Description --check-activeCheck that all servers are
ACTIVE.--check-connectedCheck that all servers are
CONNECTEDto the server performing the check.--check-leaderCheck that all servers agree on a leader.
--num-servers nCheck that the admin server membership equals n number of admin servers.
nuocmd check process --start-id <start_id>-
Subcommand Description --check-runningCheck that the database process is in the
RUNNINGstate.--check-exitedCheck that the database process has exited.
--check-liveness nCheck that the database processes has responded within n number of seconds.
For each nuocmd check command, you may add a --timeout or a --wait-forever option.
If neither is provided, the check is run once and the command returns.
Use --timeout TIMEOUT to specify how long (in seconds) to wait for the database check to pass.
Use --wait-forever to specify no limit to how long to wait for the database check to pass.
For more information on nuocmd and other command line tools, see Command Line Tools.
|
Examples
- Example 1: Using the
--check-runningsubcommand without timing out -
To check whether a database named
testis running, and wait until it is running, specify the following:nuocmd check database --db-name test --check-running --wait-forever - Example 2: Using the
--check-runningsubcommand with thetimeoutoption -
To check, for a period of 10 seconds before timing out, whether a database named
testis running, specify the following:nuocmd check database --db-name test --check-running --timeout 10 - Example 3: Using the
--num-processessubcommand with thetimeoutoption -
To check for a period of 10 seconds before timing out, whether a database named
testhas four processes ( say two TE processes and two SM processes), specify the following:nuocmd check database --db-name test --num-processes 4 --timeout 10 - Example 4: Using the
--check-runningsubcommand without timing out -
To check whether a database process with a specific start ID is running, and wait until it is running, specify the following:
nuocmd check process --start-id 1 --check-running --wait-forever - Example 5: Using the
--check-exitedsubcommand without timing out -
A
shutdown processcommand was issued onstart ID 1. To check whether the database process withstart ID 1has exited, and wait until it has, specify the following:nuocmd check process --start-id 1 --check-exited --wait-forever - Example 6: Using the
nuocmd checkcommand in a Bash if statement -
Check if database
testis running and has three database processes.if nuocmd check database --db-name test --check-running --num-processes 3; then echo "Database test is RUNNING with 3 processes" fi