PDF (A4) - 43.4Mb
Man Pages (TGZ) - 297.3Kb
Man Pages (Zip) - 402.5Kb
Info (Gzip) - 4.3Mb
Info (Zip) - 4.3Mb
MySQL Globalization
MySQL Information Schema
MySQL Installation Guide
Security in MySQL
Starting and Stopping MySQL
MySQL and Linux/Unix
MySQL and Windows
MySQL and macOS
MySQL and Solaris
Building MySQL from Source
MySQL Restrictions and Limitations
MySQL Partitioning
MySQL Tutorial
MySQL Performance Schema
MySQL Replication
Using the MySQL Yum Repository
MySQL NDB Cluster 8.0
STOP REPLICA [thread_types] [channel_option]thread_types: [thread_type [,thread_type] ... ]thread_type: IO_THREAD | SQL_THREADchannel_option: FOR CHANNELchannel Stops the replication threads. From MySQL 8.0.22, useSTOP REPLICA in place ofSTOP SLAVE, which is now deprecated. In releases before MySQL 8.0.22, useSTOP SLAVE.
STOP REPLICA requires theREPLICATION_SLAVE_ADMIN privilege (or the deprecatedSUPER privilege). Recommended best practice is to executeSTOP REPLICA on the replica before stopping the replica server (seeSection 7.1.19, “The Server Shutdown Process”, for more information).
LikeSTART REPLICA, this statement may be used with theIO_THREAD andSQL_THREAD options to name the replication thread or threads to be stopped. Note that the Group Replication applier channel (group_replication_applier) has no replication I/O (receiver) thread, only a replication SQL (applier) thread. Using theSQL_THREAD option therefore stops this channel completely.
STOP REPLICA causes an implicit commit of an ongoing transaction. SeeSection 15.3.3, “Statements That Cause an Implicit Commit”.
gtid_next must be set toAUTOMATIC before issuing this statement.
You can control how longSTOP REPLICA waits before timing out by setting the system variablerpl_stop_replica_timeout (from MySQL 8.0.26) orrpl_stop_slave_timeout (before MySQL 8.0.26). This can be used to avoid deadlocks betweenSTOP REPLICA and other SQL statements using different client connections to the replica. When the timeout value is reached, the issuing client returns an error message and stops waiting, but theSTOP REPLICA instruction remains in effect. Once the replication threads are no longer busy, theSTOP REPLICA statement is executed and the replica stops.
SomeCHANGE REPLICATION SOURCE TO |CHANGE MASTER TO statements are allowed while the replica is running, depending on the states of the replication threads. However, usingSTOP REPLICA prior to executing aCHANGE REPLICATION SOURCE TO |CHANGE MASTER TO statement in such cases is still supported. SeeSection 15.4.2.3, “CHANGE REPLICATION SOURCE TO Statement”,Section 15.4.2.1, “CHANGE MASTER TO Statement”, andSection 19.4.8, “Switching Sources During Failover”, for more information.
The optionalFOR CHANNEL clause enables you to name which replication channel the statement applies to. Providing achannelFOR CHANNEL clause applies thechannelSTOP REPLICA statement to a specific replication channel. If no channel is named and no extra channels exist, the statement applies to the default channel. If aSTOP REPLICA statement does not name a channel when using multiple channels, this statement stops the specified threads for all channels. SeeSection 19.2.2, “Replication Channels” for more information.
The replication channels for Group Replication (group_replication_applier andgroup_replication_recovery) are managed automatically by the server instance.STOP REPLICA cannot be used at all with thegroup_replication_recovery channel, and should only be used with thegroup_replication_applier channel when Group Replication is not running. Thegroup_replication_applier channel only has an applier thread and has no receiver thread, so it can be stopped if required by using theSQL_THREAD option without theIO_THREAD option.
When the replica is multithreaded (replica_parallel_workers orslave_parallel_workers is a nonzero value), any gaps in the sequence of transactions executed from the relay log are closed as part of stopping the worker threads. If the replica is stopped unexpectedly (for example due to an error in a worker thread, or another thread issuingKILL) while aSTOP REPLICA statement is executing, the sequence of executed transactions from the relay log may become inconsistent. SeeSection 19.5.1.34, “Replication and Transaction Inconsistencies”, for more information.
When the source is using the row-based binary logging format, you should executeSTOP REPLICA orSTOP REPLICA SQL_THREAD on the replica prior to shutting down the replica server if you are replicating any tables that use a nontransactional storage engine. If the current replication event group has modified one or more nontransactional tables,STOP REPLICA waits for up to 60 seconds for the event group to complete, unless you issue aKILL QUERY orKILL CONNECTION statement for the replication SQL thread. If the event group remains incomplete after the timeout, an error message is logged.
When the source is using the statement-based binary logging format, changing the source while it has open temporary tables is potentially unsafe. This is one of the reasons why statement-based replication of temporary tables is not recommended. You can find out whether there are any temporary tables on the replica by checking the value ofReplica_open_temp_tables orSlave_open_temp_tables. When using statement-based replication, this value should be 0 before executingCHANGE REPLICATION SOURCE TO |CHANGE MASTER TO. If there are any temporary tables open on the replica, issuing aCHANGE REPLICATION SOURCE TO |CHANGE MASTER TO statement after issuing aSTOP REPLICA causes anER_WARN_OPEN_TEMP_TABLES_MUST_BE_ZERO warning.
PDF (A4) - 43.4Mb
Man Pages (TGZ) - 297.3Kb
Man Pages (Zip) - 402.5Kb
Info (Gzip) - 4.3Mb
Info (Zip) - 4.3Mb
MySQL Globalization
MySQL Information Schema
MySQL Installation Guide
Security in MySQL
Starting and Stopping MySQL
MySQL and Linux/Unix
MySQL and Windows
MySQL and macOS
MySQL and Solaris
Building MySQL from Source
MySQL Restrictions and Limitations
MySQL Partitioning
MySQL Tutorial
MySQL Performance Schema
MySQL Replication
Using the MySQL Yum Repository
MySQL NDB Cluster 8.0