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 mysql database with innobackupex

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

This article mainly explains "how to use innobackupex to back up mysql database", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to use innobackupex to back up mysql database.

Innobackupex is similar to Oracle's rman. It can be used for hot backup and needs to be executed on the server side. It is one of the most commonly used tools for mysql backup.

1. Installation tools

[root@my ~] # cat / etc/redhat-release

Red Hat Enterprise Linux Server release 6.4 (Santiago)

[root@my] # rpm-ivh libev-4.15-1.el6.rf.x86_64.rpm percona-xtrabackup-24-2.4.4-1.el6.x86_64.rpm

2. Create a dedicated backup account and grant permissions

(root@localhost) [(none)] create user xtrabk@'localhost' identified by 'xtrabk'

Query OK, 0 rows affected (0.00 sec)

(root@localhost) [(none)] grant reload,process,lock tables,replication client,super on *. * to xtrabk@'localhost'

Query OK, 0 rows affected (0.00 sec)

(root@localhost) [(none)] flush privileges

Query OK, 0 rows affected (0.00 sec)

3. Back up the entire database

[root@my] # innobackupex-- defaults-file=/etc/my.cnf-- user=xtrabk-- password=xtrabk / var/lib/mysql/backup/innobackupex/

The backup files are placed under a directory that is automatically generated by time and date.

[root@my] # ll-rth / var/lib/mysql/backup/innobackupex/2017-06-20 16-33-30 /

Total 77M

-rw-r- 1 root root 76m Jun 20 16:33 ibdata1

Drwxr-x--- 2 root root 4.0K Jun 20 16:33 test

Drwxr-x--- 2 root root 4.0K Jun 20 16:33 performance_schema

Drwxr-x--- 2 root root 4.0K Jun 20 16:33 mysql

Drwxr-x--- 2 root root 12K Jun 20 16:33 sys

Drwxr-x--- 2 root root 4.0K Jun 20 16:33 5ienet

-rw-r- 1 root root 21 Jun 20 16:33 xtrabackup_binlog_info

-rw-r- 1 root root 2.5K Jun 20 16:33 xtrabackup_logfile

-rw-r- 1 root root 119 Jun 20 16:33 xtrabackup_checkpoints

-rw-r- 1 root root 504 Jun 20 16:33 ib_buffer_pool

-rw-r- 1 root root 435 Jun 20 16:33 backup-my.cnf

-rw-r- 1 root root 524 Jun 20 16:33 xtrabackup_info

The xtrabackup_checkpoints file records the Log Sequence Number of InnoDB, and the InnoDB engine table can be backed up incrementally.

4. Perform incremental backup

Do some things first:

(root@localhost) [test] insert into test1 values ('bb')

Query OK, 1 row affected (0.17 sec)

(root@localhost) [test] select * from test1

+-+

| | v1 |

+-+

| | aa |

| | bb |

+-+

2 rows in set (0.00 sec)

(root@localhost) [test] create table test4 as select * from test1

Query OK, 2 rows affected (0.81 sec)

Records: 2 Duplicates: 0 Warnings: 0

(root@localhost) [test] select * from test4

+-+

| | v1 |

+-+

| | aa |

| | bb |

+-+

2 rows in set (0.02 sec)

Then make an incremental backup:

[root@my] # innobackupex-- defaults-file=/etc/my.cnf-- user=xtrabk-- password=xtrabk-- incremental-- incremental_basedir=/var/lib/mysql/backup/innobackupex/2017-06-20 million 16-33-30 / / var/lib/mysql/backup/innobackupex/

The input log appears:

Xtrabackup: Transaction log of lsn (2338925034) to (2338925043) was copied.

Represents an incremental backup from lsn2338925034 to 2338925043.

At this point, I believe you "how to use innobackupex backup mysql database" have a deeper understanding, might as well to the actual operation of it! 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