NuoDB Command

NuoDB Command (nuocmd) is a command line tool that enables you to control, monitor, and analyze a NuoDB domain (in NuoDB deployments where NuoDB Admin is being used for domain and database management). You manage the databases in a domain by managing Transaction Engines (TEs) and Storage Managers (SMs).

Description

NuoDB Command is a text-based tool that allows you to specify commands interactively or non-interactively. To use the tool interactively, use the nuocmd command along with tab key-invoked command line autocompletion.

Syntax

nuocmd [options] subcommands

optional arguments:
-h, --help           show this help message and exit 
--api-server         API_SERVER the REST API server to send request to(default: localhost:8888)
--show-json          show the full JSON response
--show-json-fields   SHOW_JSON_FIELDS the JSON fields to show from the response
--client-key         CLIENT_KEY client key-pair if server requires client authentication 
                     (see'needClientAuth' REST setting); specified as a single file containing both <certificate> and <private key>, 
                      or as 'certificate,private key')
--server-cert        SERVER_CERT server certificate to verify when using HTTPS

subcommands:
{add,capture,connect,create,delete,enforce,get,hotcopy,import,remove,set,show,shutdown,sign,start}

Enabling Autocomplete for NuoDB Command

If the autocomplete feature is configured, you are prompted to select the next value argument(s) based on the current command you have entered. To enable autocomplete, run the following script:

. /opt/nuodb/drivers/pynuoadmin/nuocmd-complete

Using NuoDB Command's Autocomplete Feature

After enabling the autocomplete feature, valid options and first-level subcommands are displayed when you type nuocmd and press the tab key three times.

nuocmd
--api-server     --no-verify            -verify-server     capture      create       get          repare       show          start
--client-key     --show-json            -h                 check        delete       hotcopy      remove       shutdown
--help           --show-json-fields     add                connect      enforce      import       set          sign

Thereafter, type any optional argument or subcommand (or part thereof) and press the tab key twice to autocomplete the command (or display the valid options) based on the context of what has already been entered.

NuoDB Command can display the next set of valid choices. For example, type nuocmd show and press tab three times .

nuocmd show (followed by the tab key)
archives         database-connectivity  --help
certificate      domain                 log-messages
database         -h                     

Required arguments and subcommands will be indicated at runtime. For example, type nuocmd show database and press the Enter key.

nuocmd show database (followed by the Enter key)
usage: nuocmd show database [-h] --db-name DB_NAME
[--num-incarnations NUM_INCARNATIONS | --all-incarnations | --skip-exited]
[--db-format DB_FORMAT]
[--process-format PROCESS_FORMAT]
[--exited-process-format EXITED_PROCESS_FORMAT]
nuocmd show database: error: argument --db-name is required

NuoDB Command features are documented within the utility. For example, type, nuocmd show -h:

nuocmd show -h
usage: nuocmd show [-h]
		    {archives,certificate,database,database-connectivity,domain,log-messages}
		    ...

optional arguments:
  -h, --help            show this help message and exit

'show' subcommands:
  {archives,certificate,database,database-connectivity,domain,log-messages}
    archives            show database archives
    certificate         output key-pair or certificate from a keystore as a
			 base64-encoded string according to RFC-7468
    database            show database state
    database-connectivity
			show the connectivity graph for a database
    domain              show summary of domain state
    log-messages        show log messages from running database processes

Customizing the Output of Show Commands

By default, the nuocmd show... commands display long listings that include information that may not be needed when reviewing basic domain and database status. However, it is possible to customize the output of these commands so that it displays in a summary format. To do this, set nuocmd output formatting variables as follows:

export NUOCMD_SERVER_FORMAT='[{id}] {address} ({role}, Leader={leader}) {raft_state}:{connected_state}'
export NUOCMD_DB_FORMAT='{name} [{state}]'
export NUOCMD_PROCESS_FORMAT='[{engine_type}] {address::<UNKNOWN ADDRESS>} [StartId = {start_id}] [ServerId = {server_id}] {durable_state}:{engine_state}'
export NUOCMD_ARCHIVE_FORMAT='Archive: [{id}] {server_id} : {archive_path} [db = {db_name}] {state}'
export NUOCMD_API_SERVER=localhost:8888

To revert to the detailed output, run the following commands (as required):

unset NUOCMD_SERVER_FORMAT
unset NUOCMD_DB_FORMAT
unset NUOCMD_PROCESS_FORMAT
unset NUOCMD_ARCHIVE_FORMAT
unset NUOCMD_API_SERVER

See the following topics: