Skip to content

Commit

Permalink
Add tt 2.4.0 features: log, enable, --self, start -i (#4475)
Browse files Browse the repository at this point in the history
  • Loading branch information
p7nov authored Sep 2, 2024
1 parent 093760a commit 52e2f17
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 23 deletions.
4 changes: 4 additions & 0 deletions doc/tooling/tt_cli/commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ help for the given command.
- List enabled applications
* - :doc:`kill <kill>`
- Terminate Tarantool applications or instances
* - :doc:`log <log>`
- Print instance logs
* - :doc:`logrotate <logrotate>`
- Rotate instance logs
* - :doc:`pack <pack>`
Expand Down Expand Up @@ -100,13 +102,15 @@ help for the given command.
create <create>
crud <crud>
download <download>
enable <enable>
export <export>
help <help>
import <import>
init <init>
install <install>
instances <instances>
kill <kill>
log <log>
logrotate <logrotate>
pack <pack>
play <play>
Expand Down
21 changes: 21 additions & 0 deletions doc/tooling/tt_cli/enable.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.. _tt-enable:

Adding external applications to environments
============================================

.. code-block:: console
$ tt enable {APPLICATION|SCRIPT}
``tt enable`` adds an external Tarantool application to the current environment
by creating a symlink to it in the ``instances.enabled`` directory.

To add the application located in ``/home/tt-user/external_app`` to the current
``tt`` environment:

.. code-block:: console
$ tt enable /home/tt-user/external_app
Once the application is added, you can work with it the same way as with applications
created in this environment.
5 changes: 5 additions & 0 deletions doc/tooling/tt_cli/global_options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ Global options
Use the ``tt`` environment from the specified directory.
Learn more about the :ref:`local launch mode <tt-config_modes-local>`.

.. option:: -s, --self

Use the current ``tt`` version instead of executing the one located
in the :ref:`bin_dir <tt-config_file_env>` directory.

.. option:: -S, --system

Use the ``tt`` environment installed in the system.
Expand Down
6 changes: 3 additions & 3 deletions doc/tooling/tt_cli/kill.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ To terminate all instances of the ``app`` application:

.. code-block:: console
$ tt stop app
$ tt kill app
To terminate the ``storage-001-r`` instance of the ``app`` application without confirmation:

.. code-block:: console
$ tt stop app:storage-001-r --force
$ tt kill app:storage-001-r --force
To terminate the ``storage-001-r`` instance of the ``app`` application and generate its core dump:

.. code-block:: console
$ tt stop app:storage-001-r --dump
$ tt kill app:storage-001-r --dump
Options
-------
Expand Down
39 changes: 39 additions & 0 deletions doc/tooling/tt_cli/log.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
.. _tt-log:

Printing Tarantool logs
=======================

.. code-block:: console
$ tt log [APPLICATION[:APP_INSTANCE]]
``tt log`` prints the last lines of instance logs.

To print 10 last log lines of all the ``app`` application instances:

.. code-block:: console
$ tt log app
To print 50 last log lines of the ``router`` instance of the ``app`` application:

.. code-block:: console
$ tt log -n 50 app:router
To keep printing logs of the ``app`` application instances as they grow:

.. code-block:: console
$ tt log -f app
Options
-------

.. option:: -f, --follow

Keep printing new lines added to the log file.

.. option:: -n, --lines

The number of last lines to output. Default: ``10``.
17 changes: 16 additions & 1 deletion doc/tooling/tt_cli/start.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Starting Tarantool applications

.. code-block:: console
$ tt start APPLICATION[:APP_INSTANCE]
$ tt start [APPLICATION[:APP_INSTANCE]]
``tt start`` starts Tarantool applications. The application files must be stored
inside the ``instances_enabled`` directory specified in the :ref:`tt configuration file <tt-config_file_app>`.
Expand All @@ -21,6 +21,13 @@ To start all instances of the application stored in the ``app`` directory inside
$ tt start app
To start all instances of the ``app`` application appending their logs to stdout
(in the interactive mode):

.. code-block:: console
$ tt start -i app
To start the ``router`` instance of the ``app`` application:

.. code-block:: console
Expand Down Expand Up @@ -125,6 +132,14 @@ If an integrity check fails, ``tt`` stops the application.
Options
-------

.. option:: -i, --interactive

Start the application or instance in the interactive mode.
In this mode, instance logs are printed to the standard output in real time.

You can use the ``SIGINT`` signal (``CTRL+C``) to stop ``tt`` and its child
Tarantool processes in the interactive mode. No watchdog processes are created.

.. option:: --integrity-check-interval NUMBER

Integrity check interval in seconds. Default: 86400 (24 hours).
Expand Down
2 changes: 1 addition & 1 deletion doc/tooling/tt_cli/stop.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Stopping a Tarantool instance

.. code-block:: console
$ tt stop APPLICATION[:APP_INSTANCE]
$ tt stop [APPLICATION[:APP_INSTANCE]]
``tt stop`` stops the specified running Tarantool applications or instances.
When called without arguments, stops all running applications in the current environment.
Expand Down
41 changes: 23 additions & 18 deletions doc/tooling/tt_cli/tt_interactive_console.rst
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ using the ``\set output`` console command:
app:storage001> \set output table
app:storage001> box.space.bands:select { }
+------+-------------+------+
| col1 | col2 | col3 |
| id | band_name | year |
+------+-------------+------+
| 1 | Roxette | 1986 |
+------+-------------+------+
Expand All @@ -128,20 +128,25 @@ using the ``\set output`` console command:
| 3 | Ace of Base | 1987 |
+------+-------------+------+
.. note::

Field names are printed since Tarantool 3.2. On earlier versions,
actual names are replaced by numbered placeholders ``col1``, ``col2``, and so on.

The table output can be printed in the transposed format, where an object's fields
are arranged in columns instead of rows:

.. code-block:: console
app:storage001> \set output ttable
app:storage001> box.space.bands:select { }
+------+---------+-----------+-------------+
| col1 | 1 | 2 | 3 |
+------+---------+-----------+-------------+
| col2 | Roxette | Scorpions | Ace of Base |
+------+---------+-----------+-------------+
| col3 | 1986 | 1965 | 1987 |
+------+---------+-----------+-------------+
+-----------+---------+-----------+-------------+
| id | 1 | 2 | 3 |
+-----------+---------+-----------+-------------+
| band_name | Roxette | Scorpions | Ace of Base |
+-----------+---------+-----------+-------------+
| year | 1986 | 1965 | 1987 |
+-----------+---------+-----------+-------------+
.. note::

Expand All @@ -162,9 +167,9 @@ following commands:
app:storage001> \set table_format jira
app:storage001> box.space.bands:select {}
| col1 | 1 | 2 | 3 |
| col2 | Roxette | Scorpions | Ace of Base |
| col3 | 1986 | 1965 | 1987 |
| id | 1 | 2 | 3 |
| band_name | Roxette | Scorpions | Ace of Base |
| year | 1986 | 1965 | 1987 |
* ``\set grahpics`` -- enable or disable graphics for table cells in the default format:

Expand All @@ -173,20 +178,20 @@ following commands:
app:storage001> \set table_format default
app:storage001> \set graphics false
app:storage001> box.space.bands:select {}
col1 1 2 3
col2 Roxette Scorpions Ace of Base
col3 1986 1965 1987
id 1 2 3
band_name Roxette Scorpions Ace of Base
year 1986 1965 1987
* ``\set table_column_width`` -- maximum column width.

.. code-block:: console
app:storage001> \set table_column_width 6
app:storage001> box.space.bands:select {}
col1 1 2 3
col2 Roxett Scorpi Ace of
+e +ons + Base
col3 1986 1965 1987
id 1 2 3
band_n Roxett Scorpi Ace of
+ame +e +ons + Base
year 1986 1965 1987
.. _tt-interactive-console-commands:
Expand Down

0 comments on commit 52e2f17

Please sign in to comment.