Managing replica sets
$ tt replicaset COMMAND {APPLICATION[:APP_INSTANCE] | URI} [OPTIONS ...]
# or
$ tt rs COMMAND {APPLICATION[:APP_INSTANCE] | URI} [OPTIONS ...]
tt replicaset
(or tt rs
) manages a Tarantool replica set.
COMMAND
is one of the following:
$ tt replicaset status {APPLICATION[:APP_INSTANCE] | URI} [OPTIONS ...]
# or
$ tt rs status {APPLICATION[:APP_INSTANCE] | URI} [OPTIONS ...]
tt replicaset status
(tt rs status
) shows the current status of a replica set.
To view the status of all replica sets of an application in the current tt
environment, run tt replicaset status
with the application name:
$ tt replicaset status myapp
To view the status of a single replica set of an application, run tt replicaset status
with a name or a URI of an instance from this replica set:
$ tt replicaset status myapp:storage-001-a
For a replica outside the current tt
environment, specify its URI and access credentials:
$ tt replicaset status 192.168.10.10:3301 -u myuser -p p4$$w0rD
Learn about other ways to provide user credentials in Authentication.
$ tt replicaset promote {APPLICATION:APP_INSTANCE | URI} [OPTIONS ...]
# or
$ tt rs promote {APPLICATION:APP_INSTANCE | URI} [OPTIONS ...]
tt replicaset promote
(tt rs promote
) promotes the specified instance,
making it a leader of its replica set.
This command works on Tarantool clusters with a local YAML
configuration and Cartridge clusters.
Note
To promote an instance in a Tarantool cluster with a centralized configuration, use tt cluster replicaset promote.
tt replicaset promote
works on Tarantool clusters with local YAML configurations
with failover modes
off
, manual
, and election
.
In failover modes off
or manual
, this command updates the cluster
configuration file according to the specified arguments and reloads it:
off
failover mode: the command sets database.mode torw
on the specified instance.Important
If failover is
off
, the command doesn’t consider the modes of other replica set members, so there can be any number of read-write instances in one replica set.manual
failover mode: the command updates the leader option of the replica set configuration. Other instances of this replica set become read-only.
Example:
$ tt replicaset promote my-app:storage-001-a
If some members of the affected replica set are running outside the current tt
environment, tt replicaset promote
can’t ensure the configuration reload on
them and reports an error. You can skip this check by adding the -f
/--force
option:
$ tt replicaset promote my-app:storage-001-a --force
In the election
failover mode, tt replicaset promote
initiates the new leader
election by calling box.ctl.promote() on the specified instance. The
--timeout
option can be used to specify the election completion timeout:
$ tt replicaset promote my-app:storage-001-a --timeout=10
Important
The Tarantool Cartridge framework is deprecated and is not compatible with Tarantool 3.0 and later. This command is added for backward compatibility with earlier versions.
tt replicaset promote
promotes instances in Cartridge clusters as follows:
disabled
oreventual
failover mode: the command changes the instance failover priority.Important
In these cases, consistency is not guaranteed and replication conflicts may occur.
eventual
orraft
failover mode: the command callscartridge.failover_promote()
and waits until the instance transitions to the read-write mode. If the-f
/--force
option is specified, theforce_inconsistency
option of cartridge.failover_promote is set totrue
.
$ tt replicaset promote my-cartridge-app:storage-001-a --force
Learn more about Cartridge failover modes.
$ tt replicaset demote APPLICATION:APP_INSTANCE [OPTIONS ...]
# or
$ tt rs demote APPLICATION:APP_INSTANCE [OPTIONS ...]
tt replicaset demote
(tt rs demote
) demotes an instance in a Tarantool
cluster with a local YAML configuration.
Note
To demote an instance in a Tarantool cluster with a centralized configuration, use tt cluster replicaset demote.
tt replicaset demote
can demote instances in Tarantool clusters with local
YAML configurations with failover modes
off
and election
.
Note
In clusters with manual
failover mode, you can demote a read-write instance
by promoting a read-only instance from the same replica set with tt replicaset promote
.
In the off
failover mode, tt replicaset demote
sets the instance’s database.mode
to ro
and reloads the configuration.
Important
If failover is off
, the command doesn’t consider the modes of other
replica set members, so there can be any number of read-write instances in one replica set.
If some members of the affected replica set are running outside the current tt
environment, tt replicaset demote
can’t ensure the configuration reload on
them and reports an error. You can skip this check by adding the -f
/--force
option:
$ tt replicaset demote my-app:storage-001-a --force
In the election
failover mode, tt replicaset demote
initiates a leader
election in the replica set. The specified instance’s replication.election_mode
is changed to voter
for this election, which guarantees that another instance
is elected as a new replica set leader.
The --timeout
option can be used to specify the election completion timeout:
$ tt replicaset demote my-app:storage-001-a --timeout=10
You can specify the orchestrator to use for the application when calling tt replicaset
commands. The following options are available:
--config
for applications that use YAML cluster configuration (Tarantool 3.x or later).--cartridge
for Cartridge applications (Tarantool 2.x).--custom
for any other orchestrators used on Tarantool 2.x clusters.
$ tt replicaset status myapp --config
$ tt replicaset promote my-cartridge-app:storage-001-a --cartridge
If an actual orchestrator that the application uses does not match the specified option, an error is raised.
Use one of the following ways to pass the credentials of a Tarantool user when connecting to the instance by its URI:
The
-u
(--username
) and-p
(--password
) options:$ tt replicaset status 192.168.10.10:3301 -u myuser -p p4$$w0rD
The connection string:
$ tt replicaset status myuser:p4$$w0rD@192.168.10.10:3301
Environment variables
TT_CLI_USERNAME
andTT_CLI_PASSWORD
:$ export TT_CLI_USERNAME=myuser $ export TT_CLI_PASSWORD=p4$$w0rD $ tt replicaset status 192.168.10.10:3301
-
--cartridge
¶
Force the Cartridge orchestrator for Tarantool 2.x clusters.
-
--config
¶
Force the YAML configuration orchestrator for Tarantool 3.0 or later clusters.
-
--custom
¶
Force a custom orchestrator for Tarantool 2.x clusters.
-
-f
,
--force
¶
Applicable to:
promote
,demote
Skip promotion or demotion if the specified instance is not running in the same environment.
-
-u
USERNAME
,
--username
USERNAME
¶ A Tarantool user for connecting to the instance.
-
-p
PASSWORD
,
--password
PASSWORD
¶ The user’s password.
-
--sslcertfile
FILEPATH
¶ The path to an SSL certificate file for encrypted connections.
-
--sslkeyfile
FILEPATH
¶ The path to a private SSL key file for encrypted connections.
-
--sslcafile
FILEPATH
¶ The path to a trusted certificate authorities (CA) file for encrypted connections.
-
--sslciphers
STRING
¶ The list of SSL cipher suites used for encrypted connections, separated by colons (
:
).
-
--timeout
¶
Applicable to:
promote
,demote
The timeout for completing the promotion or demotion, in seconds. Default:
3
.