In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail how to restore checkpoint files through the Xtrabackup log. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
A few days ago, a friend asked me a question. When I was in xtrabackup, I didn't keep the checkpoints file. I wanted to ask if I could get the LSN information through the log. The background condition is to do a complete job.
A reference log is as follows:
171208 11:21:54 [01] Copying. / sbtest/dba_xtrabackupresult.frm to / data/backup/sbtest/dba_xtrabackupresult.frm
171208 11:21:54 [01]... done
171208 11:21:54 Finished backing up non-InnoDB tables and files
171208 11:21:54 [00] Writing / data/backup/xtrabackup_binlog_info
171208 11:21:54 [00]... done
171208 11:21:54 Executing FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS...
Xtrabackup: The latest check point (for incremental): '3985406424'
Xtrabackup: Stopping log copying thread.
.... 171208 11:21:55 > > log scanned up to (4060591382)
171208 11:21:55 > > log scanned up to (4060591382) 171208 11:21:55 Backup created in directory'/ data/backup/'
MySQL binlog position: filename 'mysqlbin.000017', position' 96607849'
171208 11:21:55 [00] Writing / data/backup/backup-my.cnf
171208 11:21:55 [00]... done
171208 11:21:55 [00] Writing / data/backup/xtrabackup_info
171208 11:21:55 [00]... done
Xtrabackup: Transaction log of lsn (3597739074) to (4060591382) was copied.
171208 11:21:57 completed OK!
You can see that there is a lot of LSN information in the log, first of all, you can get LSN information from the log, and then, if possible, how these LSN make choices.
We must introduce the principle and process diagram of xtrabackup.
In general, xtrabackup will supplement incremental data changes through physical copies. The whole process is somewhat similar to the hot standby of Oracle. The information in the log is relatively complete and is sufficient for reference.
And then how to recover, we need to know what LSN is needed.
Generally speaking, a checkpoints file requires the following LSN information
[root@tk-dba-mysql10-202 backup] # cat * checkpoints
Backup_type = full-backuped
From_lsn = xx
To_lsn = xx
Last_lsn = xx
Compact = 0
Recover_binlog_info = 0
To avoid interference, I did some filtering, and I can see that it is basically made up of FROM_LSN,TO_LSN,LAST_LSN. If it is complete, from_lsn should be 0. If the database is not loaded or there are no writes during this backup, then to_lsn and last_lsn are consistent.
But the log above is obviously backed up when the database is busy, so there are a lot of critical points of LSN, so we need to know the changes of LSN in the whole xtrabackup process through these details.
I will not beat around the bush. Through the simulation, a preliminary conclusion is as follows:
[root@tk-dba-mysql10-202 backup] # cat * checkpoints
Backup_type = full-backuped
From_lsn = 0
To_lsn = 3985406424
Last_lsn = 4060591382
Compact = 0
Recover_binlog_info = 0
How is this process simulated? the stress test is done through sysbench at the front end, and then backed up using xtrabackup. The whole process is relatively fast and can be verified in about half an hour.
This is the end of the article on "how to recover checkpoint files through Xtrabackup logs". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
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.