=head1 NAME

tarantoolctl - a utility to control Tarantool instances

=head1 SYNOPSIS

tarantoolctl COMMAND [INSTANCE] [FILE] [URI] [OPTIONS...]

=head1 DESCRIPTION

tarantoolctl may be used to introspect and control the state
of Tarantool instances.

The C<INSTANCE> represents the name of an instance file.

=head1 COMMANDS

The following commands are understood:

=over

=item start INSTANCE

Start the Tarantool instance specified on the command line if the
instance is not running. This does nothing if an instance is running.

=item stop INSTANCE

Stop the Tarantool instance specified on the command line if the instance
is running. This does nothing if an instance is not running.

=item status INSTANCE

Show status of the Tarantool instance specified on the command line
(started/stopped). If pid file exists and an alive control socket exists,
the return code is C<0>. Otherwise, the return code is not C<0>.
Reports typical problems to stderr (e.g. pid file exists and control
socket does not).

=item restart INSTANCE

Stop and start the Tarantool instance specified on the command line if
the instance is running. This does nothing if an instance is not running.

=item logrotate INSTANCE

Rotate logs of the Tarantool instance specified on the command line if
the instance is running. This works only if logging-into-file is enabled in
the instance file (C<box.cfg{log=...}> parameter). Pipe/syslog make no effect.

=item check INSTANCE

Check if there are syntax errors in the instance script of the Tarantool
instance specified on the command line.

=item enter INSTANCE

Enter the interactive console of the Tarantool instance specified on
the command line.

=item eval INSTANCE FILE

=item COMMAND | tarantoolctl eval INSTANCE

Evaluate a local file on the Tarantool instance specified on the command
line if the instance is running. This does nothing if an instance is not
running.

=item connect URI

=item COMMAND | tarantoolctl connect URI

Connect on an admin-console port to the Tarantool instance with the URI
specified on the command line. This supports both TCP/Unix sockets.

=item cat FILE... [--space=space_no...] [--show-system] [--from=from_lsn] [--to=to_lsn] [--replica=replica_id]

Print into stdout the contents of .snap/.xlog files specified on the
command line.

=item play URI FILE... [--space=space_no...] [--show-system] [--from=from_lsn] [--to=to_lsn] [--replica=replica_id]

Play the contents of .snap/.xlog files to another Tarantool instance with
URI specified on the command line.

=back

=head1 OPTIONS

The following options are understood:

=over

=item --space=space_no

Filter the output by space number. May be passed more than once.

=item --show-system

Show/play the contents of system spaces.

=item --from=from_lsn

Show/play operations starting from the given lsn.

=item --to=to_lsn

Show/play operations ending with the given lsn.

=item --replica=replica_id

Filter the output by replica ID. May be passed more than once.

=back

=head1 CONFIGURATION

The file with system-wide defaults for tarantoolctl is installed in
C</etc/default/tarantool>. This file is used when tarantoolctl is invoked
by root. When invoked by a local user, tarantoolctl first looks for its
defaults file in the current directory (C<$PWD/.tarantoolctl>), and then in
the current user's home directory (C<$HOME/.config/tarantool/tarantool>).
If not found, tarantoolctl falls back to built-in defaults:

    default_cfg = {
    pid_file  = "/var/run/tarantool",
    wal_dir   = "/var/lib/tarantool",
    memtx_dir = "/var/lib/tarantool",
    vinyl_dir = "/var/lib/tarantool",
    log       = "/var/log/tarantool",
    username  = "tarantool",
    }
    instance_dir = "/etc/tarantool/instances.enabled"

Most of these parameters are similar to those in C<box.cfg{}>:

=over

=item pid_file

Directory for the pid file and control-socket file; tarantoolctl will add
"/instance_name" to the directory name.

=item wal_dir

Directory for write-ahead *.xlog files; tarantoolctl will add
"/instance_name" to the directory name.

=item memtx_dir

Directory for snapshot *.snap files; tarantoolctl will add
"/instance_name" to the directory name.

=item vinyl_dir

Directory for vinyl files; tarantoolctl will add "/instance_name" to the
directory name.

=item log

The place where the application log will go; tarantoolctl will add
"/instance_name.log" to the name.

=item username

The user that runs the Tarantool instance. This is the operating-system
user name rather than the Tarantool-client user name. Tarantool will
change its effective user to this user after becoming a daemon.

=item instance_dir

The directory where all instance files for this host are stored. Put
instance files in this directory, or create symbolic links.

As a full-featured example, you can take C<example.lua> script that ships
with Tarantool and defines all configuration options.

=back

=head1 EXIT STATUS

On success, C<0> is returned, a non-zero failure code otherwise.

=head1 SEE ALSO

tarantool(1), Tarantool manual at http://tarantool.org/doc/

=head1 COPYRIGHT

Copyright (C) 2010-2017 Tarantool AUTHORS: please see AUTHORS file.

=cut

