Master/Slave replication interruption caused by mysql_upgrade

Source: Internet
Author: User

After 1548-cannot loadfrom mysql. Proc. The table is probably interrupted upted is processed on the master server in the production environment, an alarm is sent, and the Server Load balancer server views the Server Load balancer status during replication interruption.

Mysql> show slave status

The following statement execution error is found:

Drop databaseif exists performance_schema

Performance_schema is a database related to MySQL performance information. How can MySQL perform this operation and check the error log?

[Root @ db25522] # tail-N 500/data/my2/MySQL/db25522.err

13051310: 29: 54 [note] Error reading relay log event: slave SQL thread was killed

13051310: 29: 54 [Error] Error reading packet from server: Lost connection to mysqlserver during query (server_errno = 2013)

13051310: 29: 54 [note] slave I/O thread killed while reading event

13051310: 29: 54 [note] slave I/O thread exiting, read up to log 'mysql-bin.002734 ', position 1017737307

13051310: 29: 57 [note] slave I/O thread: connected to master 'repl @ xxx. xxx. xxx. XXX: 100', replicationstarted in log 'mysql-bin.002734 'at position 3306

13051310: 29: 57 [note] slave SQL thread initialized, starting replication in log 'mysql-bin.002734 'at position 1017729051, relay log'/My/rlog/relay-bin.000764' position: 1017729197

13053015: 00: 53 [Error] incorrect definition of table mysql. Proc: Expected column 'comment' at position 15 to have type text, found type char (64 ).

13053015: 00: 53 [Error] slave SQL: Query caused differenterrors on master and slave. error on Master: Message (Format) = 'cannot load from MySQL. % S. the tableis probably successfully upted 'error code = 1548; error on slave: actual message = 'noerror', error code = 0. default Database: 'performance _ scheme '. query: 'drop database if exists performance_schema ', error_code: 0

13053015: 00: 53 [Warning] slave: cannot load from mysql. Proc. The table is probably1_upted error_code: 1548

13053015: 00: 53 [Error] Error running query, slave SQL thread aborted. fix theproblem, and restart the slave SQL thread with "Slave start ". we stoppedat log 'mysql-bin.002947 'position 721651903

Is it because of data inconsistency? The master server has the performance_schema database, but the slave server does not. Before mysql_upgrade-uroot is executed, master-slave replication is running, after determining that the operation occurred in the mysql_upgrade-uroot, analyzing the logs on the master, during which time MySQL performed those operations

[Root @ db25522] # mysqlbinlog -- no-defaults -- start-date = '2017-05-2013: 00: 00' -- end-date = '2017-05-3015: 03: 00 'mysql-bin.002947>/root/tmp. log

Query log discovery

[Root @ db25522] # vi/root/tmp. Log

/Drop

/*! */;

# At721651876

#13053015: 00: 25 server ID 13084 end_log_pos721651903 Xid = 435509540

Commit /*! */;

# At 721651903

#13053015: 00: 53 server ID 13084 end_log_pos721652022 query thread_id = 418930 exec_time = 0 error_code = 1548

Settimestamp = 1369897253 /*! */;

/*! \ Cutf8 *//*! */;

Set @ session. character_set_client = 33, @ session. collation_connection = 33, @ session. collation_server = 28 /*! */;

Drop database if exists performance_schema

/*! */;

# At721652022

#13053015: 00: 53 server ID 13084 end_log_pos721652152 query thread_id = 418930 exec_time = 0 error_code = 0

Settimestamp = 1369897253 /*! */;

Createdatabase performance_schema Character Set utf8

/*! */;

# At721652152

#13053015: 03: 19 server ID 13084 end_log_pos721652223 query thread_id = 418956 exec_time = 0 error_code = 0

Settimestamp = 1369897399 /*! */;

/*! \ Cgbk *//*! */;

Set @ session. character_set_client = 28, @ session. collation_connection = 28, @ session. collation_server = 28 /*! */;

Begin

/*! */;

# At721652223

#13053015: 03: 19 server ID 13084 end_log_pos721652336 query thread_id = 418956 exec_time = 0 error_code = 0

Usepricedb /*! */;

Settimestamp = 1369897399 /*! */;

Okay, in the red part above, perform this operation and check the slave error log.

13053015: 00: 53 [Error] incorrect definition of table mysql. Proc: Expected column 'comment' at position 15 to have type text, found type char (64 ).

13053015: 00: 53 [Error] slave SQL: Query caused different errors on Master andslave. error on Master: Message (Format) = 'cannot load from MySQL. % S. the table is probably successfully upted 'errorcode = 1548; error on slave: actual message = 'no error', error code = 0. defaultdatabase: 'performance _ scheme '. query: 'drop database if existsperformance_schema ', error_code: 0

13053015: 00: 53 [Warning] slave: cannot load from mysql. Proc. The table is probably1_upted error_code: 1548

13053015: 00: 53 [Error] Error running query, slave SQL thread aborted. fix the problem, and restart the slave SQL thread with "Slave start ". we stopped atlog 'mysql-bin.002947 'position 721651903

5.5 of log errors are still user-friendly. The BINLOG log files read when the slave is stopped are clearly located. This provides convenience for restart slave. Since the error is caused by drop database ifexists performance_schema, skip this event.

Slave Server:

Mysql> show variables like '% skip % ';

Mysql> setglobal SQL _slave_skip_counter = 1;

Mysql> slave start;

Normal Replication

Conclusion: replication is normal. Why does mysql_upgrade perform the drop database if existsperformance_schema operation? I hope to have friends with similar problems to communicate with each other.

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.