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 n

Checks that all processes have responded within the specified number (n) of seconds.

--check-running

Checks whether the database is in the RUNNING state.

--num-processes n

Checks the number of processes.

nuocmd check servers
Subcommand Description

--check-active

Check that all servers are ACTIVE.

--check-connected

Check that all servers are CONNECTED to the server performing the check.

--check-leader

Check that all servers agree on a leader.

--num-servers n

Check that the admin server membership equals n number of admin servers.

nuocmd check process --start-id <start_id>
Subcommand Description

--check-running

Check that the database process is in the RUNNING state.

--check-exited

Check that the database process has exited.

--check-liveness n

Check 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.

The commands documented here are issued using NuoDB Command (nuocmd). For more information on NuoDB Command and other command line tools, see Command Line Tools.

Examples

Example 1: Using the --check-running subcommand without timing out

To check whether a database named test is 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-running subcommand with the timeout option

To check, for a period of 10 seconds before timing out, whether a database named test is running, specify the following:

nuocmd check database --db-name test --check-running --timeout 10
Example 3: Using the --num-processes subcommand with the timeout option

To check for a period of 10 seconds before timing out, whether a database named test has 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-running subcommand 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-exited subcommand without timing out

A shutdown process command was issued on start ID 1. To check whether the database process with start ID 1 has exited, and wait until it has, specify the following:

nuocmd check process --start-id 1 --check-exited --wait-forever
Example 6: Using the nuocmd check command in a Bash if statement

Check if database test is 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