In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
[background]
When maintaining mysql, you will always encounter examples of database recovery. It is relatively easy to recover the backup set. However, if you encounter an example of restoring to a point in time, after restoring a MySQL instance, you need to perform binlog to do an incremental recovery.
[method 1]
A common way is to parse binlog with mysqlbinlog and redirect the parsed content to the mysql command line for execution.
# start is the number after mysql-bin
Click (here) to collapse or open
I=startwhile [$I-lt end] domysqlbinlog mysql-bin.$i | mysql- h 127.0.0.1-P 4001-uroot > 0550.log 2 > & 1done can do this, and binlog in row mode can also be executed in this way. But this has several drawbacks.
1. What if the parsed binlog reports an error during execution? Is it enforced directly by adding-f?
two。 How to stop in the middle of the execution and keep running next time? For example, I want to adjust the parameters of MySQL (need to restart) and continue to run?
3. Can only be executed in a single thread. And mysqlbinlog parsing is performed through the pipeline, which has a relatively high performance overhead.
In view of the above shortcomings, here is another way to implement a large number of binlog.
[method 2]
We all know that the content of relay-log is the same as that of binlog, so can I execute binlog as a relay-log?
The answer is yes, it works all the time.
Detailed steps:
0. First make the instance normal shutdown
1. Upload binlog to the local disk of the mysql server and put it in a fixed directory, such as / home/mysql/restore_1031
two。 If it is the Mmurs architecture, you need to modify the master.info to write the following
Click (here) to collapse or open
Cat > $BINLOG_DIR/master.info
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.