Interactive console
The interactive console is Tarantool’s basic command-line interface for entering requests
and seeing results.
It is what users see when they start the server
without an instance file,
or start tarantoolctl with enter
.
The interactive console is often called the Lua console to distinguish it from the administrative console,
but in fact it can handle both Lua and SQL input.
The majority of examples in this manual show what users see with the interactive console. It includes:
tarantool>
prompt- instruction (a Lua request or an SQL statement)
- response (a display in either YAML or Lua format)
-- Interactive console example with Lua input and YAML output
tarantool> box.info().replication
---
- 1:
id: 1
uuid: a5d22f66-2d28-4a35-b78f-5bf73baf6c8a
lsn: 0
...
The input language can be changed to SQL with \set language sql
or changed to Lua (the default) with \set language lua
.
The delimiter can be changed to any character with set delimiter <character>
.
The default is nothing, which means input does not need to end with a delimiter.
But a common recommendation is to say set delimiter ;
especially if input is SQL.
The output format can be changed to Lua with \set output lua
or changed to YAML (the default) with \set output yaml
.
Ordinarily, output from the console has YAML format.
That means that there is a line for document-start "---"
,
and each item begins on a separate line starting with "- "
,
and each sub-item in a nested structure is indented,
and there is a line for document-end "..."
.
Optionally, output from the console can have Lua format.
That means that there are no lines for document-start or document-end,
and items are not on separate lines (they are only separated by commas),
and each sub-item in a nested structure is placed inside “{}
” braces.
So, when input is a Lua object description, output will equal input.
YAML is good for readability.
Lua is good for re-using results as requests.
The third format, MsgPack, is good for database storage.
Currently the default output format is YAML but it may be Lua in a future version,
and it may be Lua if
the last set_default_output
call was console.set_default_output('lua')
.
Type | Lua input | Lua output | YAML output | MsgPack storage |
---|---|---|---|---|
scalar | 1 |
1 |
--- - 1 ... |
\x01 |
scalar sequence | 1, 2, 3 |
1, 2, 3 |
--- - 1 - 2 - 3 ... |
\x01 \x02 \x03 |
2-element table | {1, 2} |
{1, 2} |
--- - - 1 - 2 ... |
0x92 0x01 0x02 |
map | {key = 1} |
{key = 1} |
--- - key: 1 ... |
\x81 \xa3 \x6b \x65 \x79 \x01 |
Since 2.10.0.
Keyboard shortcut | Effect |
---|---|
CTRL+C |
Discard current input with the SIGINT signal in the console mode and
jump to a new line with a default prompt. |
CTRL+D |
Quit Tarantool interactive console. |
Important
Keep in mind that CTRL+C
shortcut will shut Tarantool down if there is any currently running command
in the console.
The SIGINT signal stops the instance running in a daemon mode.