In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Editor to share with you mysql master and slave data inconsistency hint: Slave_SQL_Running: No solution, I believe most people do not know much, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!
This paper gives an example of the inconsistency of master and slave data in mysql, and hints on the solution of Slave_SQL_Running No. Share with you for your reference, the details are as follows:
On the slave server, use the following command
Mysql > show slave status\ G
The following is displayed:
Slave_IO_Running: Yes
Slave_SQL_Running: No
Indicates that the slave is out of sync
Solution 1 (ignore errors and continue synchronization):
1. Stop slave first
Mysql > stop slave
2. Skip the number of wrong steps, and the number of subsequent steps is variable
Mysql > set global sql_slave_skip_counter=1
3. Restart slave
Mysql > start slave
4. View synchronization status
Mysql > show slave status\ G
Solution 2 (re-master and slave, full synchronization):
1. Enter the main library to lock the table first, and be careful not to close the window.
Mysql > flush table with read lock
2. Back up the data
> mysqldump-uroot-p-- opt-R database > / data/bak.sql
3. Open a new window to view the information of the main database
Mysql > show master status +-+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set | +- -+ | mysql-bin.000005 | 1158 | + -+
4. Stop slave on the slave library
Mysql > stop slave
5. Import backup data files
Mysql > source / data/bak.sql
6. Reset synchronization
Mysql > reset slave
7. Reset the synchronization node
Mysql > CHANGE MASTER TOMASTER_HOST='192.168.137.233',MASTER_PORT=3306,MASTER_USER='sync',MASTER_PASSWORD='123456',MASTER_LOG_FILE='mysql-bin.000005',MASTER_LOG_POS=1158
Host,port,user,password should be modified according to your main library settings, and log_file and log_pos should be modified according to the master status in the main library.
8. Enable slave
Mysql > start slave
9. View slave status
Mysql > show slave status\ G
The following information is displayed as normal.
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
10. Unlock the master database
Mysql > unlock tables
11. Add or modify data in the master library again to see if the slave database data is synchronized.
The above is all the contents of this article entitled "mysql Master-Slave data inconsistency hint: Slave_SQL_Running: No solution". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.