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

How to back up and restore data incrementally by innobackupex

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

This article mainly explains "how to back up and restore data incrementally by innobackupex". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "innobackupex how to incremental backup and restore data" bar!

Download: Xtrabackup

Https://www.percona.com/downloads/XtraBackup/Percona-XtraBackup-2.4.8/binary/redhat/7/x86_64/Percona-XtraBackup-2.4.8-r97330f7-el7-x86_64-bundle.tar

Decompression, yum installation

Tar-xvf Percona-XtraBackup-2.4.8-r97330f7-el7-x86_64-bundle.taryum install percona-xtrabackup-24-2.4.8-1.el7.x86_64.rpm

Full backup

Innobackupex-user=root-password=123456-no-timestamp / backup/mysql/full

Add data in the database

Add a database db1, and create table T1 in db1 (table engine is innodb) to insert data

MariaDB [(none)] > create database if not exists db1;MariaDB [(none)] > use db1;MariaDB [db1] > create table T1 (id int,name varchar (20)) engine=innodb;MariaDB [db1] > insert into T1 values

First incremental backup

[root@apenglinux-001] # innobackupex-user=root-password=123456-no-timestamp-incremental-basedir=/backup/mysql/full-incremental / backup/mysql/01

Add data in the database

Mysql-uroot-p123456-e "insert into db1.t1 (id,name) values (2 recorder 100');"

Incremental backup the second time

[root@apenglinux-001] # innobackupex-user=root-password=123456-no-timestamp-incremental-basedir=/backup/mysql/01-incremental / backup/mysql/02

Simulate data loss and delete everything in the database

Cd / var/lib/mysql/rm-rf *

Restore a full backup

[root@apenglinux-001 mysql] # innobackupex-user=root-password=123456-apply-log-redo-only / backup/mysql/full/

Restore the first incremental backup

[root@apenglinux-001 mysql] # innobackupex-user=root-password=123456-apply-log-redo-only / backup/mysql/full/-incremental-dir=/backup/mysql/01

Restore the second incremental backup

[root@apenglinux-001 mysql] # innobackupex-user=root-password=123456-apply-log / backup/mysql/full/-incremental-dir=/backup/mysql/02

Apply-log the merged data as a whole.

[root@apenglinux-001 mysql] # innobackupex-user=root-password=123456-copy-back / backup/mysql/full/

Set permissions

[root@apenglinux-001 mysql] # chown-R mysql.mysql / var/lib/mysql/

Restart to see if the recovery is successful

[root@apenglinux-001 mysql] # systemctl restart MariaDB [root @ apenglinux-001 mysql] # mysql-uroot-p123456-e "select * from db1.t1 "+-+-+ | id | name | +-+-+ | 1 | aa | | 2 | 100 | +-+-+. I believe you have a better understanding of" how to back up and recover data incrementally by innobackupex ". You might as well do it in practice! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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