Connecting to a Tarantool instance
$ tt connect {URI|INSTANCE_NAME} [OPTION ...]
tt connect
connects to a Tarantool instance by its URI or instance name specified
in the current environment.
-
-u
USERNAME
,
--username
USERNAME
¶ A Tarantool user for connecting to the instance.
-
-p
PASSWORD
,
--password
PASSWORD
¶ The user’s password.
-
-f
FILEPATH
,
--file
FILEPATH
¶ Connect and evaluate the script from a file.
-
– read the script from stdin.
-
-i
,
--interactive
¶
Enter the interactive mode after evaluating the script passed in
-f
/--file
.
-
-l
LANGUAGE
,
--language
LANGUAGE
¶ The input language of the tt interactive console:
lua
(default) orsql
.
-
-x
FORMAT
,
--outputformat
FORMAT
¶ The output format of the tt interactive console:
yaml
(default),lua
,table
,ttable
.
-
--sslcertfile
FILEPATH
¶ The path to an SSL certificate file for encrypted connections.
-
--sslkeyfile
FILEPATH
¶ The path to a private SSL key file for encrypted connections.
-
--sslcafile
FILEPATH
¶ The path to a trusted certificate authorities (CA) file for encrypted connections.
-
--sslciphers
STRING
¶ The list of SSL cipher suites used for encrypted connections, separated by colons (
:
).
To connect to an instance, tt
typically needs its URI – the host name or IP address
and the port.
You can also connect to instances in the same tt
environment
(that is, those that use the same configuration file and Tarantool installation)
by their instance names.
When connecting to an instance by its URI, tt connect
establishes a remote connection
for which authentication is required. Use one of the following ways to pass the
username and the password:
- The
-u
(--username
) and-p
(--password
) options:
$ tt connect 192.168.10.10:3301 -u myuser -p p4$$w0rD
- The connection string:
$ tt connect myuser:p4$$w0rD@192.168.10.10:3301 -u myuser -p p4$$w0rD
- Environment variables
TT_CLI_USERNAME
andTT_CLI_PASSWORD
:
$ export TT_CLI_USERNAME=myuser
$ export TT_CLI_PASSWORD=p4$$w0rD
$ tt connect 192.168.10.10:3301
If no credentials are provided for a remote connection, the user is automatically guest
.
Note
Local connections (by instance name instead of the URI) don’t require authentication.
To connect to instances that use SSL encryption, provide the SSL certificate and
SSL key files in the --sslcertfile
and --sslkeyfile
options. If necessary,
add other SSL parameters – --sslcafile
and --sslciphers
.
By default, tt connect
opens an interactive tt console.
Alternatively, you can open a connection to evaluate a Lua script from a file or stdin.
To do this, pass the file path in the -f
(--file
) option or use -f -
to take the script from stdin.
$ tt connect app -f test.lua
Connect to the
app
instance in the same environment:$ tt connect app
Connect to the
master
instance of theapp
application in the same environment:$ tt connect app:master
Connect to the
192.168.10.10
host on port3301
with authentication:$ tt connect 192.168.10.10:3301 -u myuser -p p4$$w0rD
Connect to the
app
instance and evaluate the code from thetest.lua
file:$ tt connect app -f test.lua
Connect to the
app
instance and evaluate the code from stdin:$ echo "function test() return 1 end" | tt connect app -f - # Create the test() function $ echo "test()" | tt connect app -f - # Call this function