Master-Slave copy report 1173 error handling

Source: Internet
Author: User
Tags dba error code error handling

During the business stress testing of a project, the following problems were encountered:
The Zabbix monitor message displays the following error:
2016.09.28 19:16:11
Trigger:mysql error log desc in lines_2
Values:mysql error_log:2016-09-28 19:16:10 47236992240384 [ERROR] Slave sql:error ' This table type requires a primary ke Y ' on query.
Default database: '. Query: ' ALTER TABLE m_g_ver.g_d_c drop primary key,add unique key (' id ') ', Gtid 0-74603306-1854116,
Internal mariadb error Code:1173mysql error_log:2016-09-28 19:16:10 47236992240384 [ERROR] Slave sql:error ' This table Type requires a primary key ' on query.
Default database: '. Query: ' ALTER TABLE m_g_ver.g_d_c drop primary key,add unique key (' id ') ', Gtid 0-74603306-1854116,
Internal mariadb error code:1173 MYSQL error_log:2016-09-28 19:16:10 47236992240384 [ERROR] Slave sql:error ' This table Type requires a primary key ' on query.
Default database: '. Query: ' ALTER TABLE m_g_ver.g_d_c drop primary key,add unique key (' id ') ', Gtid 0-74603306-1854116,
Internal mariadb Error code:1173
Check from library:
dba@192.168.74.61:3306 (db (from)): (none) 08:49:57>show slave status\g
1. Row ***************************
Slave_io_state:waiting for Master to send event
master_host:192.168.74.60
Master_user:repl
master_port:3306
Connect_retry:60
master_log_file:mysql-bin.000004
read_master_log_pos:161535100
relay_log_file:relay-bin.000012
relay_log_pos:161498545
relay_master_log_file:mysql-bin.000004
Slave_io_running:yes
Slave_sql_running:no
replicate_do_db:
replicate_ignore_db:
Replicate_do_table:
Replicate_ignore_table:
Replicate_wild_do_table:
Replicate_wild_ignore_table:
last_errno:1173
Last_error:error ' This table type requires a primary key ' on query. Default database: '. Query: ' ALTER TABLE m_g_ver.g_d_c drop primary key,add unique key (' id ') '
skip_counter:0
exec_master_log_pos:161498257
relay_log_space:1235284687
From the above, it is an error to perform an ALTER TABLE M_g_ver.g_d_c drop primary Key,add a unique key (' ID ') from the library, comparing the main library and the Innodb_force_primary_key parameter settings from the library:
Main Library:
+--------------------------+-------+
| variable_name | Value |
+--------------------------+-------+
| Innodb_force_primary_key | Off |
+--------------------------+-------+
From library:
+--------------------------+-------+
| variable_name | Value |
+--------------------------+-------+
| Innodb_force_primary_key | On |
+--------------------------+-------+
See from the above argument that because the main library has the primary key mandatory feature turned off and the library is not closed, the shutdown is performed from the library:
Set global Innodb_force_primary_key=off;
Then start the SQL thread from the library:
Start slave sql_thread;
Then look at the slave state, no longer error, and so the SQL thread to perform all the relay log, that is, synchronization completed.
dba@192.168.74.61:3306 ((from)): Sd_sl_ver 09:02:32>show slave status\g
1. Row ***************************
Slave_io_state:waiting for Master to send event
master_host:192.168.74.60
Master_user:repl
master_port:3306
Connect_retry:60
master_log_file:mysql-bin.000004
read_master_log_pos:162029482
relay_log_file:relay-bin.000012
relay_log_pos:161499911
relay_master_log_file:mysql-bin.000004
Slave_io_running:yes
Slave_sql_running:yes
replicate_do_db:
replicate_ignore_db:
Replicate_do_table:
Replicate_ignore_table:
Replicate_wild_do_table:
Replicate_wild_ignore_table:
last_errno:0
Last_error:
skip_counter:0
exec_master_log_pos:161499623
relay_log_space:1235779069
Until_condition:none
Until_log_file:
Finally, perform the above operation on the second from the library.








Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.