Managing centralized migrations
Enterprise Edition
This command is supported by the Enterprise Edition only.
$ tt migrations COMMAND [COMMAND_OPTION ...]
tt migrations manages centralized migrations
in a Tarantool EE cluster. See Centralized migrations with tt for a detailed guide
on using the centralized migrations mechanism.
Important
Only Tarantool EE clusters with etcd centralized configuration storage are supported.
COMMAND is one of the following:
$ tt migrations publish ETCD_URI [MIGRATIONS_DIR | MIGRATION_FILE] [OPTION ...]
tt migrations publish sends the migration files to the cluster’s centralized
configuration storage for future execution.
By default, the command sends all files stored in migrations/ inside the current
directory.
$ tt migrations publish "https://user:pass@localhost:2379/myapp"
To select another directory with migration files, provide a path to it as the command argument:
$ tt migrations publish "https://user:pass@localhost:2379/myapp" my_migrations
To publish a single migration from a file, use its name or path as the command argument:
$ tt migrations publish "https://user:pass@localhost:2379/myapp" migrations/000001_create_space.lua
Optionally, you can provide a key to use as a migration identifier instead of the filename:
$ tt migrations publish "https://user:pass@localhost:2379/myapp" file.lua  \
                        --key=000001_create_space.lua
When publishing migrations, tt performs checks for:
- Syntax errors in migration files. To skip syntax check, add the --skip-syntax-checkoption.
- Existence of migrations with same names. To overwrite an existing migration with
the same name, add the --overwirteoption.
- Migration names order. By default, tt migrationsonly adds new migrations to the end of the migrations list ordered lexicographically. For example, if migrations001.luaand003.luaare already published, an attempt to publish002.luawill fail. To force publishing migrations disregarding the order, add the--ignore-order-violationoption.
Warning
Using the options that ignore checks when publishing migration may cause migration inconsistency in the cluster.
$ tt migrations apply ETCD_URI [OPTION ...]
tt migrations apply applies published migrations
to the cluster. It executes all migrations from the cluster’s centralized
configuration storage on all its read-write instances (replica set leaders).
$ tt migrations apply "https://user:pass@localhost:2379/myapp"  \
                    --tarantool-username=admin --tarantool-password=pass
To apply a single published migration, pass its name in the --migration option:
$ tt migrations apply "https://user:pass@localhost:2379/myapp"  \
                    --tarantool-username=admin --tarantool-password=pass  \
                    --migration=000001_create_space.lua
To apply migrations on a single replica set, specify the replicaset option:
$ tt migrations apply "https://user:pass@localhost:2379/myapp"  \
                    --tarantool-username=admin --tarantool-password=pass  \
                    --replicaset=storage-001
The command also provides options for migration troubleshooting: --ignore-order-violation,
--force-reapply, and --ignore-preceding-status. Learn to use them in
Troubleshooting migrations.
Warning
The use of migration troubleshooting options may lead to migration inconsistency in the cluster. Use them only for local development and testing purposes.
$ tt migrations status ETCD_URI [OPTION ...]
tt migrations status prints the list of migrations published to the centralized
storage and the result of their execution on the cluster instances.
Possible migration statuses are:
- APPLY_STARTED– the migration execution has started but not completed yet
- or has been interrupted with tt migrations stop <tt-migrations-stop>`
 
- APPLIED– the migration is successfully applied on the instance
- FAILED– there were errors during the migration execution on the instance
To get the list of migrations stored in the given etcd storage and information about their execution on the cluster, run:
$ tt migrations status "https://user:pass@localhost:2379/myapp"  \
                       --tarantool-username=admin --tarantool-password=pass
If the cluster uses SSL encryption, add SSL options. Learn more in Authentication.
Use the --migration and --replicaset options to get information about specific
migrations or replica sets:
$ tt migrations status "https://user:pass@localhost:2379/myapp"  \
                     --tarantool-username=admin --tarantool-password=pass \
                     --replicaset=storage-001 --migration=000001_create_writers_space.lua
The --display-mode option allows to tailor the command output:
- with --display-mode config-storage, the command prints only the list of migrations published to the centralized storage.
- with --display-mode cluster, the command prints only the migration statuses on the cluster instances.
To find out the results of a migration execution on a specific replica set in the cluster, run:
$ tt migrations status "https://user:pass@localhost:2379/myapp"  \
                       --tarantool-username=admin --tarantool-password=pass  \
                       --replicaset=storage-001 --display-mode=cluster
$ tt migrations stop ETCD_URI [OPTION ...]
tt migrations stop stops the execution of migrations in the cluster.
Warning
Calling tt migration stop may cause migration inconsistency in the cluster.
To stop the execution of a migration currently running in the cluster:
$ tt migrations stop "https://user:pass@localhost:2379/myapp"  \
                     --tarantool-username=admin --tarantool-password=pass
tt migrations stop interrupts a single migration. If you call it to interrupt
the process that applies multiple migrations, the ones completed before the call
receive the APPLIED status. The migration is interrupted by the call remains in
APPLY_STARTED.
$ tt migrations remove ETCD_URI [OPTION ...]
tt migrations remove removes published migrations from the centralized storage.
With additional options, it can also remove the information about the migration execution
on the cluster instances.
To remove all migrations from a specified centralized storage:
$ tt migrations remove "https://user:pass@localhost:2379/myapp"  \
                       --tarantool-username=admin --tarantool-password=pass
To remove a specific migration, pass its name in the --migration option:
$ tt migrations remove "https://user:pass@localhost:2379/myapp"  \
                       --tarantool-username=admin --tarantool-password=pass  \
                       --migration=000001_create_writers_space.lua
Before removing migrations, the command checks their status
on the cluster. To ignore the status and remove migrations anyway, add the
--force-remove-on=config-storage option:
$ tt migrations remove "https://user:pass@localhost:2379/myapp"  \
                        --force-remove-on=config-storage
Note
In this case, cluster credentials are not required.
To remove migration execution information from the cluster (clear the migration status),
use the --force-remove-on=cluster option:
$ tt migrations remove "https://user:pass@localhost:2379/myapp"  \
                       --tarantool-username=admin --tarantool-password=pass  \
                       --force-remove-on=cluster
To clear all migration information from the centralized storage and cluster,
use the --force-remove-on=all option:
$ tt migrations remove "https://user:pass@localhost:2379/myapp"  \
                       --tarantool-username=admin --tarantool-password=pass  \
                       --force-remove-on=all
Since tt migrations operates migrations via a centralizes etcd storage, it
needs credentials to access this storage. There are two ways to pass etcd credentials:
- command-line options --config-storage-usernameand--config-storage-password
- the etcd URI, for example, https://user:pass@localhost:2379/myapp
Credentials specified in the URI have a higher priority.
For commands that connect to the cluster (that is, all except publish), Tarantool
credentials are also required. The are passed in the --tarantool-username and
--tarantool-password options.
If the cluster uses SSL traffic encryption, provide the necessary connection
parameters in the --tarantool-ssl* options: --tarantool-sslcertfile,
--tarantool-sslkeyfile, and other. All options are listed in Options.
- 
--acquire-lock-timeoutINT¶
- Applicable to: - apply- Migrations fiber lock acquire timeout in seconds. Default: 60. Fiber lock is used to prevent concurrent migrations run 
- 
--config-storage-passwordSTRING¶
- A password for connecting to the centralized migrations storage (etcd). - See also: Authentication. 
- 
--config-storage-usernameSTRING¶
- A username for connecting to the centralized migrations storage (etcd). - See also: Authentication. 
- 
--display-modeSTRING¶
- Applicable to: - status- Display only specific information. Possible values: - config-storage– information about migrations published to the centralized storage.
- cluster– information about migration applied on the cluster.
 - See also: status. 
- 
--execution-timeoutINT¶
- Applicable to: - apply,- remove,- status,- stop- A timeout for completing the operation on a single Tarantool instance, in seconds. Default values: - 3for- remove,- status, and- stop
- 3600for- apply
 
- 
--force-reapply¶
- Applicable to: - apply- Apply migrations disregarding their previous status. - Warning - Using this option may lead to migrations inconsistency in the cluster. 
- 
--force-remove-onSTRING¶
- Applicable to: - remove- Remove migrations disregarding their status. Possible values: - config-storage: remove migrations on etcd centralized migrations storage disregarding the cluster apply status.
- cluster: remove migrations status info only on a Tarantool cluster.
- allto execute both- config-storageand- clusterforce removals.
 - Warning - Using this option may lead to migrations inconsistency in the cluster. 
- 
--ignore-order-violation¶
- Applicable to: - apply,- publish- Skip migration scenarios order check before publish. - Warning - Using this option may lead to migrations inconsistency in the cluster. 
- 
--ignore-preceding-status¶
- Applicable to: - apply- Skip preceding migrations status check on apply. - Warning - Using this option may lead to migrations inconsistency in the cluster. 
- 
--keySTRING¶
- Applicable to: - publish- Put scenario to - /<prefix>/migrations/scenario/<key>etcd key instead. Only for single file publish.
- 
--migrationSTRING¶
- Applicable to: - apply,- remove,- status- A migration to apply, remove, or check status. 
- 
--overwrite¶
- Applicable to: - publish- overwrite existing migration storage keys. - Warning - Using this option may lead to migrations inconsistency in the cluster. 
- 
--replicasetSTRING¶
- Applicable to: - apply,- remove,- status,- stop- Execute the operation only on the specified replica set. 
- 
--skip-syntax-check¶
- Applicable to: - publish- Skip syntax check before publish. - Warning - Using this option may cause further - tt migrationscalls to fail.
- 
--tarantool-authSTRING¶
- Applicable to: - apply,- remove,- status,- stop- Authentication type used to connect to the cluster instances. 
- 
--tarantool-connect-timeoutINT¶
- Applicable to: - apply,- remove,- status,- stop- Tarantool cluster instances connection timeout, in seconds. Default: 3. 
- 
--tarantool-passwordSTRING¶
- Applicable to: - apply,- remove,- status,- stop- A password used to connect to the cluster instances. 
- 
--tarantool-sslcafileSTRING¶
- Applicable to: - apply,- remove,- status,- stop- SSL CA file used to connect to the cluster instances. 
- 
--tarantool-sslcertfileSTRING¶
- Applicable to: - apply,- remove,- status,- stop- SSL cert file used to connect to the cluster instances. 
- 
--tarantool-sslciphersSTRING¶
- Applicable to: - apply,- remove,- status,- stop- Colon-separated list of SSL ciphers used to connect to the cluster instances. 
- 
--tarantool-sslkeyfileSTRING¶
- Applicable to: - apply,- remove,- status,- stop- SSL key file used to connect to the cluster instances. 
- 
--tarantool-sslpasswordSTRING¶
- Applicable to: - apply,- remove,- status,- stop- SSL key file password used to connect to the cluster instances. 
- 
--tarantool-sslpasswordfileSTRING¶
- Applicable to: - apply,- remove,- status,- stop- File with list of password to SSL key file used to connect to the cluster instances. 
- 
--tarantool-use-ssl¶
- Applicable to: - apply,- remove,- status,- stop- Whether SSL is used to connect to the cluster instances. 
- 
--tarantool-usernameSTRING¶
- Applicable to: - apply,- remove,- status,- stop- A username for connecting to the Tarantool cluster instances.