Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
p7nov committed Sep 27, 2024
1 parent ba2a9fd commit 0d20803
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 45 deletions.
2 changes: 1 addition & 1 deletion doc/code_snippets/snippets/migrations/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Centralized configuration storages
# Centralized migrations with tt

Sample applications demonstrating how to use the centralized migration mechanism
for Tarantool EE clusters via the tt utility. Learn more at [Centralized configuration storages](https://www.tarantool.io/en/doc/latest/platform/https://www.tarantool.io/en/doc/latest/platform/ddl_dml/migrations/).
13 changes: 8 additions & 5 deletions doc/platform/ddl_dml/migrations/centralized_migrations_tt.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@ Centralized migrations with tt
In this section, you learn to use the centralized migration management mechanism
implemented in the Enterprise Edition of the :ref:`tt <tt-cli>` utility.

See also:

- :ref:`tt migrations reference <tt-migrations>` for the full list of command-line options.
- :ref:`tcm_cluster_migrations` to learn about managing migrations from |tcm_full_name|.
The section includes the following tutorials:

.. toctree::
:maxdepth: 1

basic_migrations_tt
upgrade_migrations_tt
extend_migrations_tt
troubleshoot_migrations_tt
troubleshoot_migrations_tt


See also:

- :ref:`tt migrations reference <tt-migrations>` for the full list of command-line options.
- :ref:`tcm_cluster_migrations` to learn about managing migrations from |tcm_full_name|.
38 changes: 13 additions & 25 deletions doc/platform/ddl_dml/migrations/extend_migrations_tt.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. _extend_migrations_tt:

Centralized migrations with tt
==============================
Extending the cluster
=====================

**Example on GitHub:** `migrations <https://github.com/tarantool/doc/tree/latest/doc/code_snippets/snippets/migrations>`_

Expand All @@ -13,7 +13,9 @@ added cluster instances using the centralized migration management mechanism.
Prerequisites
-------------

Before starting this tutorial, complete the :ref:`_basic_migrations_tt` and :ref:`upgrade_migrations_tt`
Before starting this tutorial, complete the :ref:`basic_migrations_tt` and :ref:`upgrade_migrations_tt`.
As a result, you have a sharded Tarantool EE cluster that uses an etcd-based configuration
storage. The cluster has a space with two indexes.

.. _extend_migrations_tt_cluster:

Expand Down Expand Up @@ -71,34 +73,20 @@ Apply all stored migrations to the cluster to load the same data schema to the n

.. code-block:: console
$ tt migrations apply http://app_user:config_pass@localhost:2379/myapp \
--tarantool-username=client --tarantool-password=secret
• router-001:
• 000001_create_writes_space.lua: skipped, already applied
• 000002_create_writers_index.lua: skipped, already applied
• 000003_alter_writers_space.lua: skipped, already applied
• storage-001:
• 000001_create_writes_space.lua: skipped, already applied
• 000002_create_writers_index.lua: skipped, already applied
• 000003_alter_writers_space.lua: skipped, already applied
• storage-002:
• 000001_create_writes_space.lua: skipped, already applied
• 000002_create_writers_index.lua: skipped, already applied
• 000003_alter_writers_space.lua: skipped, already applied
• storage-003:
• 000001_create_writes_space.lua: successfully applied
• 000002_create_writers_index.lua: successfully applied
• 000003_alter_writers_space.lua: successfully applied
$ tt migrations apply http://app_user:config_pass@localhost:2379/myapp \
--tarantool-username=client --tarantool-password=secret
--replicaset storage-003
.. note::

You can apply migrations to a specific replica set using the ``--replicaset`` option:
You can also apply migrations without specifying the replica set. All published
migrations are already applied on other replica sets, so ``tt`` skips the
operation on them.

.. code-block:: console
$ tt migrations apply http://app_user:config_pass@localhost:2379/myapp \
--tarantool-username=client --tarantool-password=secret
--replicaset storage-003
$ tt migrations apply http://app_user:config_pass@localhost:2379/myapp \
--tarantool-username=client --tarantool-password=secret
To make sure that the space exists on the new instances, connect to ``storage-003-a``
and check ``box.space.writers``:
Expand Down
4 changes: 2 additions & 2 deletions doc/platform/ddl_dml/migrations/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,6 @@ troubleshooting migration issues. :ref:`troubleshooting_migrations_tt`.
.. toctree::
:maxdepth: 1

space_upgrade
centralized_migrations_tt
troubleshooting_migrations_tt
space_upgrade

28 changes: 16 additions & 12 deletions doc/platform/ddl_dml/migrations/upgrade_migrations_tt.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Complex migrations with space.upgrade()
**Example on GitHub:** `migrations <https://github.com/tarantool/doc/tree/latest/doc/code_snippets/snippets/migrations>`_

In this tutorial, you learn to write migrations that include data migration using
the ``space.upgrade`` function.
the ``space.upgrade()`` function.

See also:

Expand All @@ -18,15 +18,19 @@ See also:
Prerequisites
-------------

Before starting this tutorial, complete the :ref:`_basic_migrations_tt`.
Before starting this tutorial, complete the :ref:`basic_migrations_tt`.
As a result, you have a sharded Tarantool EE cluster that uses an etcd-based configuration
storage. The cluster has a space with two indexes.

.. _upgrade_migrations_tt_write:

Writing a complex migration
---------------------------

Complex migrations require data migration along with schema migration. Insert some
tuples into the space before proceeding to the next steps:
Complex migrations require data migration along with schema migration. Connect to
the router instance and insert some tuples into the space before proceeding to the next steps.

.. code-block:: $ tt connect myapp:router-001

.. code-block:: tarantoolsession
Expand Down Expand Up @@ -98,26 +102,26 @@ Publish the new migration to etcd. Migrations that already exist in the storage

.. code-block:: console
$ tt migrations publish http://app_user:config_pass@localhost:2379/myapp
• 000001_create_writes_space.lua: skipped, key "000001_create_writes_space.lua" already exists with the same content
• 000002_create_writers_index.lua: skipped, key "000002_create_writers_index.lua" already exists with the same content
• 000003_alter_writers_space.lua: successfully published to key "000003_alter_writers_space.lua"
$ tt migrations publish http://app_user:config_pass@localhost:2379/myapp \
migrations/scenario/000003_alter_writers_space.lua
.. note::

You can also publish a single migration file by passing a path to it as an argument:
You can also publish all migrations from the default location ``/migrations/scenario``.
All other migrations stored in this directory are already published, so ``tt``
skips them.

.. code-block:: console
$ tt migrations publish http://app_user:config_pass@localhost:2379/myapp \
migrations/scenario/000003_alter_writers_space.lua
$ tt migrations publish http://app_user:config_pass@localhost:2379/myapp
.. _upgrade_migrations_tt_apply:

Applying the migration
----------------------

Apply the migrations:
Apply the published migrations:

.. code-block:: console
Expand Down

0 comments on commit 0d20803

Please sign in to comment.