In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Preface
The basic principle of master-slave replication of MySQL is to connect from the library to the master library, and the master library generates a master library DUMP thread. The main task of the DUMP thread is
The binlog log is mined all the time, and then sent to the IO thread of the slave library. After receiving the log stream, the IO thread writes to relay log, another line.
The program relay log thread reads the contents of the sql and then replays the SQL statement.
This article mainly introduces you about the state transition of MySQL master-slave replication thread. Let's take a look at the detailed introduction.
1. The thread status (State) value of the main library
The following list shows the most common state (SHOW PROCESSLIST) that you might see in the State column of the Binlog Dump thread of the master server in the master-slave replication. If the Binlog Dump thread is not visible on the primary server, this means that the replication is not running, that is, no Slave hosts are currently connected.
Sending binlog event to slave
The binary log consists of various events, and an event is usually an update plus some other information. The thread has read an event from the binary log and is sending it to the slave server.
Finished reading one binlog; switching to next binlog
The thread has finished reading the binary log file and is opening the next log file to be sent to the slave server.
Has sent all binlog to slave; waiting for binlog to be updated
The thread has read all major updates from the binary log and has sent them to the slave server. The thread is now idle, waiting for new events to appear in the binary log caused by new updates on the primary server.
Waiting to finalize termination
A very simple state that occurs when a thread stops.
Second, the thread state (State) value from the library Imax O
Connecting to master
The thread is trying to connect to the primary server.
Checking master version
A temporary state that occurs immediately after a connection with the primary server is established.
Registering slave on master
A temporary state that occurs immediately after a connection with the primary server is established.
Requesting binlog dump
A temporary state that occurs immediately after a connection with the primary server is established. The thread sends a request to the primary server for the contents of the binary log starting from the requested binary log file name and location.
Waiting to reconnect after a failed binlog dump request
If the binary log dump request fails (because there is no connection), the thread goes to sleep and then periodically attempts to reconnect. You can use the-master-connect-retry option to specify the interval between retries.
Reconnecting after a failed binlog dump request
The thread is trying to reconnect to the primary server.
Waiting for master to send event
The thread is connected to the primary server and is waiting for the binary log event to arrive. If the primary server is idle, it will last for a long time. If the wait lasts for slave_read_timeout seconds, a timeout occurs. At this point, the thread thinks the connection is broken and attempts to reconnect.
Queueing master event to the relay log
The thread has read an event and is copying it to the relay log for processing by the SQL thread.
Waiting to reconnect after a failed master event read
An error occurred while reading (because there is no connection), and the thread will sleep for master-connect-retry seconds before attempting to reconnect.
Reconnecting after a failed master event read
The thread is trying to reconnect to the primary server, and when the connection is reestablished, the state changes to Waiting for master to send event.
Waiting for the slave SQL thread to free enough relay log space
A non-zero relay _ log_space_ value is being used, and the relay log has grown to a combined size that exceeds that value. The Icano thread is waiting until the SQL thread processes the contents of the relay log and deletes some of the relay log files to free up enough space.
Waiting for slave mutex on exit
A very simple state that occurs when a thread stops.
3. SQL thread status (State) value from the library
Reading event from the relay log
The thread has read an event from the relay log and is ready to process the event.
Has read all relay log; waiting for the slave I/O thread to update it
The thread has processed all the events in the relay log file and is now waiting for the I / O thread to write the new event to the relay log.
Waiting for slave mutex on exit
A very simple state that occurs when a thread stops.
Fourth, connect thread status (State) values from the library
These thread states occur on the replication slave library, but are associated with the connection thread, not with the Imax O or SQL thread.
Changing master
The thread is processing the CHANGE MASTER TO statement.
Killing slave
The thread is processing the STOP SLAVE statement.
Opening master dump table
This state occurs after Creating table from master dump.
Reading master dump table data
This state occurs after Opening master dump table.
Rebuilding the index on master dump table
This state occurs after Reading master dump table data.
Summary
The above is the whole content of this article, I hope that the content of this article has a certain reference and learning value for your study or work, if you have any questions, you can leave a message and exchange, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.