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.
-
-uUSERNAME,--usernameUSERNAME¶ A Tarantool user for connecting to the instance.
-
-pPASSWORD,--passwordPASSWORD¶ The user’s password.
-
-fFILEPATH,--fileFILEPATH¶ 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.
-
-lLANGUAGE,--languageLANGUAGE¶ The input language of the tt interactive console:
lua(default) orsql.
-
-xFORMAT,--outputformatFORMAT¶ The output format of the tt interactive console:
yaml(default),lua,table,ttable.
-
--sslcertfileFILEPATH¶ The path to an SSL certificate file for encrypted connections.
-
--sslkeyfileFILEPATH¶ The path to a private SSL key file for encrypted connections.
-
--sslcafileFILEPATH¶ The path to a trusted certificate authorities (CA) file for encrypted connections.
-
--sslciphersSTRING¶ 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
Environment variables
TT_CLI_USERNAMEandTT_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.
Примечание
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
appinstance in the same environment:$ tt connect app
Connect to the
masterinstance of theappapplication in the same environment:$ tt connect app:master
Connect to the
192.168.10.10host on port3301with authentication:$ tt connect 192.168.10.10:3301 -u myuser -p p4$$w0rD
Connect to the
appinstance and evaluate the code from thetest.luafile:$ tt connect app -f test.lua
Connect to the
appinstance 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