下面的列表显示了在副本服务器上复制 I/O(接收端)线程的 State 列中最常见的状态。该状态也会出现在 Replica_IO_State 显示的 SHOW
REPLICA STATUS 列中,因此您可以通过使用该语句很好地了解正在发生的情况。The following list shows the most common states you see in the
State column for a replication I/O (receiver)
thread on a replica server. This state also appears in the
Replica_IO_State column displayed by
SHOW
REPLICA STATUS, so you can get a good view of what is
happening by using that statement.
在 MySQL 8.0 中,对监控指标名称进行了不兼容的更改。使用这些监控指标名称的监控工具可能会受到影响。如果这些不兼容的更改对您有影响,请将 terminology_use_previous 系统变量设置为 BEFORE_8_0_26,以使 MySQL 服务器使用前面列表中指定对象的旧名称版本。这可以使依赖旧名称的监控工具继续工作,直到它们可以更新以使用新名称为止。In MySQL 8.0, incompatible changes were made to instrumentation
names. Monitoring tools that work with these instrumentation
names might be impacted. If the incompatible changes have an
impact for you, set the
terminology_use_previous system
variable to BEFORE_8_0_26 to make MySQL
Server use the old versions of the names for the objects
specified in the previous list. This enables monitoring tools
that rely on the old names to continue working until they can be
updated to use the new names.
将 terminology_use_previous 系统变量设置为会话范围以支持单独函数,或设置为全局范围以作为所有新会话的默认值。当使用全局范围时,慢查询日志包含名称的旧版本。Set the
terminology_use_previous system
variable with session scope to support individual functions, or
global scope to be a default for all new sessions. When global
scope is used, the slow query log contains the old versions of
the names.
Checking master versionChecking master versionChecking source versionChecking source version在与源建立连接后,极短时间内发生的一种状态。A state that occurs very briefly, after the connection to the source is established.
Connecting to masterConnecting to masterConnecting to sourceConnecting to source线程正在尝试连接到源。The thread is attempting to connect to the source.
Queueing master event to the relay logQueueing master event to the relay logQueueing source event to the relay logQueueing source event to the relay log线程已经读取了一个事件,并将其复制到中继日志,以便 SQL 线程可以处理它。The thread has read an event and is copying it to the relay log so that the SQL thread can process it.
Reconnecting after a failed binlog dump requestReconnecting after a failed binlog dump request线程正在尝试重新连接到源。The thread is trying to reconnect to the source.
Reconnecting after a failed master event readReconnecting after a failed master event readReconnecting after a failed source event readReconnecting after a failed source event read线程正在尝试重新连接到源服务器。当连接再次建立时,状态变为
Waiting for master to send event。The thread is trying to reconnect to the source. When connection is established again, the state becomesWaiting for master to send event.Registering slave on masterRegistering slave on masterRegistering replica on sourceRegistering replica on source在与源建立连接后很短暂出现的一种状态。A state that occurs very briefly after the connection to the source is established.
Requesting binlog dumpRequesting binlog dump在连接到源建立后非常短暂地发生的一种状态。线程向源发送请求,以获取其二进制日志的内容,从请求的二进制日志文件名和位置开始。A state that occurs very briefly, after the connection to the source is established. The thread sends to the source a request for the contents of its binary logs, starting from the requested binary log file name and position.
Waiting for its turn to commitWaiting for its turn to commit当副本线程在等待旧的工作线程提交时发生的状态,如果启用了
replica_preserve_commit_order。A state that occurs when the replica thread is waiting for older worker threads to commit ifreplica_preserve_commit_orderis enabled.Waiting for master to send eventWaiting for master to send eventWaiting for source to send eventWaiting for source to send event线程已连接到源,并正在等待二进制日志事件的到来。如果源处于空闲状态,这可能会持续很长时间。如果等待时间达到
replica_net_timeout秒,则会发生超时。到那时,线程会认为连接已断开,并尝试重新连接。The thread has connected to the source and is waiting for binary log events to arrive. This can last for a long time if the source is idle. If the wait lasts forreplica_net_timeoutseconds, a timeout occurs. At that point, the thread considers the connection to be broken and makes an attempt to reconnect.Waiting for master updateWaiting for master updateWaiting for source updateWaiting for source update在
Connecting to master或Connecting to source之前的初始状态。The initial state beforeConnecting to masterorConnecting to source.Waiting for slave mutex on exitWaiting for slave mutex on exitWaiting for replica mutex on exitWaiting for replica mutex on exit在线程停止时短暂发生的状态。A state that occurs briefly as the thread is stopping.
Waiting for the slave SQL thread to free enough relay log spaceWaiting for the slave SQL thread to free enough relay log spaceWaiting for the replica SQL thread to free enough relay log spaceWaiting for the replica SQL thread to free enough relay log space您正在使用非零的
relay_log_space_limit值,中继日志已经增长到足够大,其总大小超过了该值。I/O(接收)线程正在等待,直到 SQL(应用)线程通过处理中继日志内容释放出足够的空间,以便它可以删除一些中继日志文件。You are using a nonzerorelay_log_space_limitvalue, and the relay logs have grown large enough that their combined size exceeds this value. The I/O (receiver) thread is waiting until the SQL (applier) thread frees enough space by processing relay log contents so that it can delete some relay log files.Waiting to reconnect after a failed binlog dump requestWaiting to reconnect after a failed binlog dump request如果二进制日志转储请求失败(由于断开连接),线程将在休眠时进入此状态,然后尝试定期重新连接。重试间隔可以使用
CHANGE REPLICATION SOURCE TO进行指定。If the binary log dump request failed (due to disconnection), the thread goes into this state while it sleeps, then tries to reconnect periodically. The interval between retries can be specified using theCHANGE REPLICATION SOURCE TO.Waiting to reconnect after a failed master event readWaiting to reconnect after a failed master event readWaiting to reconnect after a failed source event readWaiting to reconnect after a failed source event read读取时发生错误(由于断开连接)。线程会在尝试重新连接之前,按照
CHANGE REPLICATION SOURCE TO语句设置的秒数休眠。An error occurred while reading (due to disconnection). The thread is sleeping for the number of seconds set by theCHANGE REPLICATION SOURCE TOstatement before attempting to reconnect.