Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What should I do if Error 1236 occurs when MySQL is powered off?

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

MySQL power outage appears Error 1236 how to do, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.

Today, several MySQL servers have a sudden power outage. Replication cannot be started after restart. The following error is always reported:

080922 10:29:01 [Note] Slave SQL thread initialized, starting replication in log 'mysql-bin.000778' at position 2874108, relay log'

. / relay-bin.003287' position: 2874245

080922 10:29:01 [Note] Slave I amp O thread: connected to master 'replication@192.168.0.10:3306', replication started in log' mysql-b

In.000778' at position 2874108

080922 10:29:01 [ERROR] Error reading packet from server: Client requested master to start replication from impossible position (se

Rver_errno=1236)

080922 10:29:01 [ERROR] Got fatal error 1236: 'Client requested master to start replication from impossible position' from master wh

En reading data from binary log

[@ more@]

Why did you sign up for impossible position? Open mysql-bin.000778 and have a look.

Mysqlbinlog mysql-bin.000778 > log.sql

Tail-f log.sql

# at 2871574

# 080922 10:20:27 server id 2 end_log_pos 2871601 Xid = 2516638

Com _ MIT _ blank /

DELIMITER

# End of log file

ROLLBACK / * added by mysqlbinlog * /

/ *! 50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/

The last position is 2871574, and the library starts from 2874108. No wonder impossible position is reported. Is there a part of log that hasn't been written to binglog in the cache when the power is off? Anyway, let's recover first.

Stop slave

CHANGE MASTER TO

MASTER_LOG_FILE='mysql-bin.000778'

MASTER_LOG_POS=2871574

Start slave

Show slave statusG

Synchronization is normal.

Later check this paragraph in the startup log of the main library

InnoDB: Last MySQL binlog file position 0 2874108, file name. / mysql-bin.000778

080922 10:22:09 InnoDB: Started; log sequence number 6 2534366248

080922 10:22:09 [Note] Recovering after a crash using mysql-bin

080922 10:22:09 [Note] Starting crash recovery...

080922 10:22:09 [Note] Crash recovery finished.

080922 10:22:09 [Note] / usr/sbin/mysqld: ready for connections.

Last MySQL binlog file position 2874108 is also wrong here. Where on earth did this information come from? What causes it? I don't understand.

In order to ensure that the binglog is written in time in the future, set the main library sync_binlog variable to 1.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, 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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report