In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The mysql database is suddenly out of sync.
View the status of slave
Show slave status\ G
View the log
2019-03-11 18:40:03 10283 [ERROR] Slave SQL: Error 'Duplicate entry' 39 'for key' PRIMARY'' on query. Default database: 'db_jd'. Query: 'insert into tb_goods values (null,'ty','10.45','27','')', Error_code: 1062
2019-03-11 18:40:03 10283 [Warning] Slave: Duplicate entry '39' for key' PRIMARY' Error_code: 1062
2019-03-11 18:40:03 10283 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'mysql-bin.000003' position 10743.
It is said on the Internet that it is possible to write in slave.
The solution is
Mysql > stop slave
Mysql > set GLOBAL SQL_SLAVE_SKIP_COUNTER=1
Mysql > start slave
It still doesn't work. By the way, my database is a dual-master model. Of course, slave can be written.
I also saw on the Internet that the format of binlog was incorrect, and then checked my.cnf.
It was found that a few items were indeed missing, and the contents in the red box were not originally found, but were added later.
Then restart mysql
View the log
Another error was reported.
2019-03-11 19:34:36 454 [ERROR] Slave SQL: Slave failed to initialize relay log info structure from the repository, Err or_code: 1872
It was said on the Internet that it was caused by the previous residual files, so the two files were deleted.
Rm-rf slave-relay-bin.index
Rm-rf relay-log.info
Restart mysql
Then reconfigure mysql synchronization to enter mysql1
Mysql > stop slave
Query OK, 0 rows affected (0.05 sec)
View mysql-bin and position on mysql2
Mysql > show master status
Mysql > change master to master_host='192.168.255.57',master_port=3306,master_user='zhangsan',master_password='123456',m aster_log_file='mysql-bin.000006',master_log_pos=120
Query OK, 0 rows affected, 2 warnings (0.41 sec)
Mysql > start slave
Query OK, 0 rows affected (0.05 sec)
Mysql > show slave status\ G
Mysql2 is also reconfigured
Mysql > stop slave
Query OK, 0 rows affected (0.05 sec)
View mysql-bin and position on mysql1
Mysql > show master status
Mysql > change master to master_host='192.168.255.52',master_port=3306,master_user='zhangsan',master_password='123456',m aster_log_file='mysql-bin.000008',master_log_pos=120
Query OK, 0 rows affected, 2 warnings (0.30 sec)
Mysql > start slave
Query OK, 0 rows affected (0.03 sec)
Mysql > show slave status\ G
Then insert the data into the database and synchronize.
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.