A. Installation of MySQL backup tool xtrabackup 1. Percona official xtrabackup binary version; the binary version can be used after decompression. 2. Unzip xtrabackup & create a connection tar -xzvf percona-xtrabackup-2.3.4-Linux-x86_64.tar.gz -C /usr/local/ 3. Set the PATH environment variable B. Create a user backup user & authorization in mysql database 1. Create a user create user backuper@'localhost' identified by 'backup123'; 2. Authorization grant reload,lock tables,replication client,process,super on *.* to 'backuper'@'localhost'; C. Check before backup. The main purpose of this step is to verify whether the restore is effective when performing the restore operation later. (There is no such step in production. 1. select * from tempdb.dict__major; +--------------+-----------------+ D. Back up the tempdb.dict__major table 1. Backup command innobackupex --host=127.0.0.1 --user=backuper --password=backup123 --port=3306 --include='tempdb.dict__major' /tmp/tempdb 2. After the backup is completed, a directory named with the current time will be generated under the backup directory (/tmp/tempdb), which contains the backup files. tree /tmp/tempdb/ E. After the backup is complete, you can delete the tempdb.dict__major table (note that you must save a copy of the table definition, which will be used when restoring) mysql>drop table tempdb.dict__major; F. In order to obtain a consistent backup set, the log must be rolled forward and rolled back before the restore operation. 1. Roll forward & roll back logs innobackupex --apply-log --export /tmp/tempdb/2016-09-10_18-25-16/ 2. Comparison with before rollforward & rollback tree /tmp/tempdb/ G. Restore the tempdb.dict__major table 1. Create the tempdb.dict__major table create table dict__major( 2. Delete the tempdb.dict__major tablespace file alter table tempdb.dict__major discard tablespace; 3. Copy the tablespace file from the backup to the location where the tempdb.dict__major tablespace should be located cp /tmp/tempdb/2016-09-10_18-25-16/tempdb/dict__major.ibd /usr/local/mysql/data/tempdb/ 4. Import tablespace files alter table tempdb.dict__major import tablespace; 5. Check the recovery status of the dict__major table select * from dict__major; --------------------------------------------------------------- In the previous section, xtrabackup was used to back up the table. Its application scenario is that the data volume of a single table is large and the write operation of the table must be supported during the backup process; that is, in the current scenario, mysqldump, a simple Backup tools can also meet the requirements;
A: Create a backup user 1. B: Back up the tempdb.dict__major table 1. C: Delete the backed up table 1. D: Restore the tempdb.dict__major table 1. E: Verify the validity of the restoration 1. +--------------+-----------------+ The above article briefly talks about MySQL backup and restore for a single table. This is all I want to share with you. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. You may also be interested in:
|
<<: js implements clock component based on canvas
>>: Detailed explanation of 2 methods to synchronize network time in Linux/CentOS system
As more and more Docker images are used, there ne...
Table of contents Achieve results Introduction to...
1. The proxy_pass directive of the 1.ngx_stream_p...
This article shares the specific code for JavaScr...
This article uses examples to illustrate the erro...
Table of contents 1. Concept 1.1 What are errors ...
This article takes the connection error ECONNREFU...
Preface If you are like me, as a hard-working Jav...
Table of contents 1. Primary key exists 2. No pri...
Although Microsoft provides T4 templates, I find ...
The props of the component (props is an object) F...
1. Introduction to mysqldump mysqldump is a logic...
This article describes how to use docker to deplo...
1. Add a comment block at the beginning of the sty...
This article describes how to enable https servic...