Top.Mail.Ru
Running admin functions | Tarantool
Tarantool
Check out the new release 2.8

Running admin functions

Running admin functions

Use cartridge admin to call admin functions provided by the application.

cartridge admin [ADMIN_FUNC_NAME] [flags]

--name Application name (required)
--list List the available admin functions
--help Display help for an admin function
--instance Name of the instance to connect to
--conn, -c Address to connect to
--run-dir The directory to place the instance’s sockets (defaults to /var/run/tarantool)

admin also supports global flags.

Your application can provide admin functions. First, you have to register them using the admin extension. The example application contains a function named probe, which probes an instance at a specified URI.

Note

If your function calls print, the message is displayed on cartridge admin call (since cartridge-cli-extensions 1.1.0).

Note

Your admin functions shouldn’t accept arguments with names that conflict with cartridge admin option names:

  • name
  • list
  • help
  • instance
  • run_dir
  • debug
  • quiet
  • verbose

When the --conn flag is specified, CLI connects to the address provided.

When the --instance flag is specified, CLI checks if the socket <run-dir>/<name>.<instance>.control is available and if so, uses it to run the admin command. Otherwise, CLI checks all <run-dir>/<name>.*.control sockets and uses the first available socket to run an admin command.

An available socket is one that can be connected to. For more insight into the search for an available socket, use the --verbose flag.

This example shows how to use the example admin function, probe.

Get a list of available admin functions:

cartridge admin --name APPNAME --list

   • Available admin functions:

probe  Probe instance

Get help for a specific function:

cartridge admin --name APPNAME probe --help

   • Admin function "probe" usage:

Probe instance

Args:
  --uri string  Instance URI

Call a function with an argument:

cartridge admin --name APPNAME probe --uri localhost:3301

   • Probe "localhost:3301": OK