Overview
This section contains information about the YTsaurus command line: description, installation methods, and use cases.
Description
The YTsaurus CLI (Command Line Interface) is the most convenient way to interact with the YTsaurus system from the console. The CLI fully implements the features of all the commands supported by YTsaurus. The name of the command is specified as the first argument followed by its options. To get help on the CLI, just run the command:
yt --help
yt read --help
To work with a cluster, you need to get an access token and put it in the ~/.yt/token file or the YT_TOKEN environment variable.
For more information about the tokens and authentication, see the Authentication section.
In addition to the access token, you need to specify the cluster to work with. To do this, you can specify the proxy server name in the YT_PROXY environment variable: export YT_PROXY=<cluster-name> or pass the proxy server name to each command individually via the proxy option, such as --proxy <cluster-name>.
Below are some features of the CLI:
-
All underscores in command and option names were replaced by hyphens.
-
input_table_pathsandoutput_table_pathsare specified via the--srcand--dstoptions. -
To specify multiple columns for sort or reduce, pass the
sort-byorreduce-byoption several times, for example,--sort-by a --sort-by bwill sort by composite keya b.Attention!
If you write
--sort-by a,b, sorting by one column nameda,bwill be performed. -
The
writecommand writes data chunk-by-chunk and under the transaction. -
There is a
findcommand (implemented on top of get) which partially replicates the unix find utility. -
By default, the
listcommand (without specifying the--formatparameter) just enters a list of node elements, each on a separate string. It also has the-loption that will enter useful information about the nodes along with their names. -
By default, any files uploaded into YTsaurus are uploaded without the executable flag. If you want to upload a binary file that will run in a job, you must specify the
--executableoption when uploading or set the/@executable=trueattribute after uploading. -
The formats of the data received at the command input and appearing at the command output can be specified through the following environment variables:
YT_ARGUMENTS_FORMAT: Manages the format for the values of the options of the--spec,--attributestype. The default value isyson.YT_STRUCTURED_DATA_FORMAT: Manages the format of the get/set command. The default value isyson.YT_TABULAR_DATA_FORMAT: Manages the format of reading/writing tables, as well as starting operation jobs. There is no default value, the variable value must be set explicitly or the--formatoption must be specified.
-
There is a method to create aliases for commands. Aliases are specified in the
~/.yt/aliasesfile inname=optsformat. Example:mkdir=create map_node ls=list rm=remove mv=move cp=copy -
Auto-completion of binary file commands and paths for bash is supported.