diff --git a/doc/code_snippets/snippets/migrations/README.md b/doc/code_snippets/snippets/migrations/README.md index cc27a6627..1f2f58b29 100644 --- a/doc/code_snippets/snippets/migrations/README.md +++ b/doc/code_snippets/snippets/migrations/README.md @@ -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/). diff --git a/doc/platform/ddl_dml/migrations/centralized_migrations_tt.rst b/doc/platform/ddl_dml/migrations/centralized_migrations_tt.rst index 9de6c83b6..db59261a7 100644 --- a/doc/platform/ddl_dml/migrations/centralized_migrations_tt.rst +++ b/doc/platform/ddl_dml/migrations/centralized_migrations_tt.rst @@ -8,10 +8,7 @@ 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 ` utility. -See also: - -- :ref:`tt migrations reference ` 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 @@ -19,4 +16,10 @@ See also: basic_migrations_tt upgrade_migrations_tt extend_migrations_tt - troubleshoot_migrations_tt \ No newline at end of file + troubleshoot_migrations_tt + + +See also: + +- :ref:`tt migrations reference ` for the full list of command-line options. +- :ref:`tcm_cluster_migrations` to learn about managing migrations from |tcm_full_name|. \ No newline at end of file diff --git a/doc/platform/ddl_dml/migrations/extend_migrations_tt.rst b/doc/platform/ddl_dml/migrations/extend_migrations_tt.rst index 4a2a9f2ed..369ff449a 100644 --- a/doc/platform/ddl_dml/migrations/extend_migrations_tt.rst +++ b/doc/platform/ddl_dml/migrations/extend_migrations_tt.rst @@ -1,7 +1,7 @@ .. _extend_migrations_tt: -Centralized migrations with tt -============================== +Extending the cluster +===================== **Example on GitHub:** `migrations `_ @@ -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: @@ -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``: diff --git a/doc/platform/ddl_dml/migrations/index.rst b/doc/platform/ddl_dml/migrations/index.rst index b3a36019e..1ea5186a5 100644 --- a/doc/platform/ddl_dml/migrations/index.rst +++ b/doc/platform/ddl_dml/migrations/index.rst @@ -165,6 +165,6 @@ troubleshooting migration issues. :ref:`troubleshooting_migrations_tt`. .. toctree:: :maxdepth: 1 - space_upgrade centralized_migrations_tt - troubleshooting_migrations_tt + space_upgrade + diff --git a/doc/platform/ddl_dml/migrations/upgrade_migrations_tt.rst b/doc/platform/ddl_dml/migrations/upgrade_migrations_tt.rst index c145ea7d5..7404558ae 100644 --- a/doc/platform/ddl_dml/migrations/upgrade_migrations_tt.rst +++ b/doc/platform/ddl_dml/migrations/upgrade_migrations_tt.rst @@ -6,7 +6,7 @@ Complex migrations with space.upgrade() **Example on GitHub:** `migrations `_ In this tutorial, you learn to write migrations that include data migration using -the ``space.upgrade`` function. +the ``space.upgrade()`` function. See also: @@ -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 @@ -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