START SLAVE
The terms master and slave have historically been used in replication, and MariaDB has begun the process of adding primary and replica synonyms. The old terms will continue to be used to maintain backward compatibility - see MDEV-18777 to follow progress on this effort.
Syntax
START SLAVE ["connection_name"] [thread_type [, thread_type] ... ] START SLAVE ["connection_name"] [SQL_THREAD] UNTIL MASTER_LOG_FILE = 'log_name', MASTER_LOG_POS = log_pos START SLAVE ["connection_name"] [SQL_THREAD] UNTIL RELAY_LOG_FILE = 'log_name', RELAY_LOG_POS = log_pos START SLAVE ["connection_name"] [SQL_THREAD] UNTIL MASTER_GTID_POS = <GTID position> START ALL SLAVES [thread_type [, thread_type]] thread_type: IO_THREAD | SQL_THREAD
Contents
Description
START SLAVE
with no thread_type options starts both of the slave
threads (see replication). The I/O thread reads events from the master server and stores
them in the relay log. The SQL thread reads events from the relay log
and executes them. START SLAVE
requires the SUPER
privilege.
If START SLAVE
succeeds in starting the slave threads, it returns
without any error. However, even in that case, it might be that the
slave threads start and then later stop (for example, because they do
not manage to connect to the master or read its binary log, or some
other problem). START SLAVE
does not warn you about this. You must
check the slave's error log for error messages generated by the slave
threads, or check that they are running satisfactorily with SHOW SLAVE
STATUS
.
START SLAVE UNTIL
START SLAVE UNTIL
refers to the SQL_THREAD
slave position at which the SQL_THREAD
replication will halt. If SQL_THREAD
isn't specified both threads are started.
MariaDB starting with 10.0.2
Since version 10.0.2, START SLAVE UNTIL master_gtid_pos=xxx
has also been supported. See Global Transaction ID/START SLAVE UNTIL master_gtid_pos=xxx for more details.
connection_name
MariaDB starting with 10.0
The connection_name
option was added as part of multi-source replication added in MariaDB 10.0
If there is only one nameless master, or the default master (as specified by the default_master_connection
system variable) is intended, connection_name
can be omitted. If provided, the START SLAVE
statement will apply to the specified master. connection_name
is case-insensitive.
START ALL SLAVES
MariaDB starting with 10.0
START ALL SLAVES
starts all configured slaves (slaves with master_host not empty) that were not started before. It will give a note
for all started connections. You can check the notes with SHOW WARNINGS
.
START REPLICA
MariaDB starting with 10.5.1
START REPLICA
is an alias for START SLAVE
from MariaDB 10.5.1.
See Also
- Setting up replication.
- CHANGE MASTER TO is used to create and change connections.
- STOP SLAVE is used to stop a running connection.
- RESET SLAVE is used to reset parameters for a connection and also to permanently delete a master connection.