Manage the system using the WEKA CLI
The overview of the WEKA CLI includes top-level commands, command hierarchy, how to connect to another server, auto-completion, and how to check the status of the cluster.
The WEKA CLI is installed on each WEKA server and is available through the weka
command. It's possible to connect to any of the servers using ssh
and running the weka
command. The weka
command displays a list of all top-level commands.
Top-level commands
The WEKA CLI is installed on each WEKA server and is available through the weka
command. Running this command displays a list of all top-level commands:
The options that are common to many commands include:
Option | Description |
---|---|
| Prints the raw JSON value returned by the cluster. |
| Directs the CLI to communicate with the cluster through the specified hostname or IP. |
| Sets the units such as capacity and bytes to be printed in their raw format, as returned by the cluster. |
| Sets the timestamps to be printed in UTC timezone, instead of the local time of the server running the CLI command. |
| Specifies the format to output the result (view, csv, markdown, or JSON). |
| Specifies the columns to include in the output. |
| Specifies the order to sort the output. May include a '+' or '-' before the column name to sort by ascending or descending order. |
| Specifies the filter values for a member (without forcing it to be in the output). |
| Indicates that the column header should not be shown when printing the output. |
| Modifies the default timeout used for connecting to the system via the JRPC protocol. |
| Modifies the default timeout for which the commands wait for a response before giving up. |
| Controls the usage of color in the outputs. Possible values: Default: |
Throughout the documentation, the CLI mandatory parameters are marked with an asterisk (*).
Commands hierarchy
Most WEKA system top-level commands are the default list command for their own collection. Additional sub-commands may be available under them.
Example: The weka fs
command displays a list of all filesystems and is also the top-level command for all filesystems, filesystem groups, and snapshot-related operations. It is possible to use the -h
/--help
flags or the help
command to display a list of available commands at each level, as shown below:
Connect to another server
Most WEKA system commands deliver the same result on all cluster servers. However, it is sometimes necessary to run a command on a specific server. To do this, use the -H/--hostname
option and specify the hostname or IP address of the target server.
CLI auto-completion
Using bash
you can use auto-completion for CLI commands and parameters. The auto-completion script is automatically installed.
To disable the auto-completion script, run weka agent autocomplete uninstall
To (re-)install the script on a server, run weka agent autocomplete install
and re-enter your shell session.
You can also use weka agent autocomplete export
to get the bash completions script and write it to any desired location.
WEKA CLI command output colors
The weka status
command and various commands that return tables, such as weka cluster buckets
, support colored output by default when executed in a terminal (tty). You can control the use of colors with the --color
option or the WEKA_CLI_COLOR
environment variable.
Colors are used sparingly and consistently to indicate status:
Green: Indicates that the status is OK.
Yellow: Represents a warning or a transient state, such as initializing or rebuilding.
Red: Indicates an error or an issue that needs attention.
Colors are only used when formatting in "human" formats (such as plain text). They are not applied when the output is in machine-readable formats such as JSON, CSV, or Markdown.
--color
option usage
--color
option usageThe --color
option controls the usage of color in the outputs. It expects one of the following values:
enabled: Forces color output to be enabled, regardless of the output destination.
disabled: Disables color output entirely.
auto: Automatically determines whether to enable color based on the output destination. If the output is a terminal that supports color, it is enabled; otherwise, it is disabled. The Default:
auto
When the auto
value is selected, the environment variable is also respected. If NO_COLOR
is set in the environment, color output is disabled, regardless of the output destination.
WEKA_CLI_COLOR
environment variable usage
WEKA_CLI_COLOR
environment variable usageThis environment variable can set the color output with the same possible values as the --color
parameter (enabled
, disabled
, auto
). However, if the --color
parameter is specified, it overrides the WEKA_CLI_COLOR
environment variable.
Cluster status
The weka status
command displays the overall status of the WEKA cluster.
Examples: