Performing migrations
Тarantool Cluster Manager provides a web interface for managing and performing migrations in connected clusters. To learn more about migrations in Tarantool, see migrations.
Migrations are named Lua files with code that alters the cluster data schema, for example, creates a space, changes its format, or adds indexes. In TCM, there is a dedicated page where you can organize migrations, edit their code, and apply them to the cluster.
The tools for managing migrations from TCM are located on the Cluster > Migrations page.
To create a migration:
-
Click Add (the + icon) on the Migrations page.
-
Enter the migration name.
-
Write the migration code in the editor window. Use the box.schema module reference to learn how to work with Tarantool data schema.
Once you complete writing the migration, save it by clicking Save. This saves the migration that is currently opened in the editor.
After you prepare a set of migrations, apply it to the cluster. To apply all saved migrations to the cluster at once, click Apply.
Migrations that were created but not saved yet are not applied when you click Apply.
To check the migration results on the cluster, use the Migrated widget on the cluster stateboard. It reflects the general result of the last applied migration set:
- If all saved migration are applied successfully, the widget is green.
- If any migration from this set fails on certain instances, the widget color changes to yellow.
- If there are saved migrations that are not applied yet, the widget becomes gray.
Hovering a cursor over the widget shows the number of instances on which the currently saved migration set is successfully applied.
You can also check the status of each particular migration on the Migrations page. The migrations that are successfully applied are marked with green check marks. Failed migrations are marked with exclamation mark icons (!). Hover the cursor over the icon to see the information about the error. The pop-up lists the replica sets on which the migration failed and the error message for each of them.

To apply the migration again, click Force apply in this pop-up. For details, see Force applying a migration.
The Force apply button applies the migration again regardless of its
current status: applied, apply_started, or failed. A regular apply
(Apply) skips migrations with the applied status.
Use Force apply in the following cases:
- The migration failed and remains in the
failedstatus. First, fix the cause of the error, for example, correct the migration code and save it. Then click Force apply. - The migration is stuck in the
apply_startedstatus, for example, if the process was stopped during the apply. - The migration is already applied, but its code was fixed, and it needs to be run again.
Force apply only disables the status check of the selected migration. The checks of the apply order and of the previous migrations' statuses remain in place.
The following migration code creates a formatted space with two indexes in a sharded cluster:
local function apply_scenario()local space = box.schema.space.create('customers')space:format {{ name = 'id', type = 'number' },{ name = 'bucket_id', type = 'number' },{ name = 'name', type = 'string' },}space:create_index('primary', { parts = { 'id' } })space:create_index('bucket_id', { parts = { 'bucket_id' }, unique = false })endreturn {apply = {scenario = apply_scenario,},}