Home Database Mysql Tutorial 利用XtrabBackup工具备份及恢复

利用XtrabBackup工具备份及恢复

Jun 07, 2016 pm 05:31 PM

Xtrabackup 是percona的一个开源项目,可以热备份innodb ,XtraDB,和MyISAM(会锁表),可以看做是InnoDB Hotbackup的免费替代品

Xtrabackup------MySQL DBA的必备工具

注意:

1)文档参照:start

2)mysql要使用5.1.50版本或以上。

一、Xtrabackup简介及安装

1、Xtrabackup  是percona的一个开源项目,可以热备份innodb ,,XtraDB,和MyISAM(会锁表),可以看做是InnoDB Hotbackup的免费替代品。

Percona Support for MySQL

BenefitSilver
(Per Server)Gold
(Unlimited)Platinum
(Unlimited)

Annual Price $1,500/server From $15,000 From $30,000

Number of Servers Covered Per-Server Unlimited Unlimited

Number of Support Incidents Unlimited Unlimited Unlimited

Response Time SLA 60 Minutes 30 Minutes 30 Minutes

Named Support Contact Persons 5 10 20

Email, Web, & Chat Support

Yes

Yes

Yes

Phone Support

Yes

Yes

Yes

Login Support

Yes

Yes

Yes

24×7 Support

Yes

Yes

Yes

Fixes For Verified Bugs  

Yes

Yes

Hot Bug Fixes    

Yes

Onsite System Audit   Option

Yes

Covers Old Server Versions    

Yes

Covers Non-Standard Platforms     Option

Covers Custom Code     Option

参考:
 
 
 
先看看如何安装Xtrabackup,最简单的安装方式是使用RPM包,不过想使用源代码方式安装的话,其安装方式有点古怪,因为它采用的在MySQL源代码上打补丁构建的方式安装的。
 
2、安装:
 
wget
 
tar zxf xtrabackup-1.4.tar.gz
 
cd xtrabackup-1.4
 
./configure
 
make
 
进行到这里时,千万别make install,那样就会接着安装MySQL了,正确方法是:
 
cd innobase/xtrabackup/
 
make
 
make install
 
安装参照::installation:from-source
 
3、如此一来,就会在/usr/bin目录里安装上两个有用的工具:xtrabackup、innobackupex
 
1)xtrabackup  只能备份InnoDB和XtraDB两种数据表,支持在线热备份,可以在不加锁的情况备份Innodb数据表,不过此工具不能操作Myisam引擎表
 
2)innobackupex  是一个脚本封装,封装了xtrabackup,能同时处理Innodb和Myisam,但在处理Myisam时需要加一个读锁。
 
 
 
按如上的介绍,由于操作Myisam时需要加读锁,这会堵塞线上服务的写操作,而Innodb没有这样的限制,所以数据库中Innodb表类型所占的比例越大,则越有利。实际应用中一般是直接使用innobackupex方法,它主要有三种操作方式,按手册中的介绍:
 

 

Usage:
 
innobackup [--sleep=MS] [--compress[=LEVEL]] [--include=REGEXP] [--user=NAME]
 
          [--password=WORD] [--port=PORT] [--socket=SOCKET] [--no-timestamp]
 
          [--ibbackup=IBBACKUP-BINARY] [--slave-info] [--stream=tar]
 
          [--defaults-file=MY.CNF]
 
          [--databases=LIST] [--remote-host=HOSTNAME] BACKUP-ROOT-DIR
 
innobackup --apply-log [--use-memory=MB] [--uncompress] [--defaults-file=MY.CNF]
 
          [--ibbackup=IBBACKUP-BINARY] BACKUP-DIR
 
innobackup --copy-back [--defaults-file=MY.CNF] BACKUP-DIR
 
——————————————————————————————————
 
第一个命令行是热备份mysql数据库。
 
带有--apply-log选项的命令是准备在一个备份上启动mysql服务。
 
带有--copy-back选项的命令从备份目录拷贝数据,索引,日志到my.cnf文件里规定的初始位置。
 
Xtrabackup还可以用来moving InnoDB tables between servers,更多的内容可以参考官方文档及例子。 

参考链接:
 
1.官方文档::xtrabackup_manual
 
2.Xtrabackup online backup for InnoDB/XTraDB(pdf):
 

 
推荐阅读:

MySQL开源备份工具Xtrabackup备份部署

MySQL Xtrabackup备份和恢复

用XtraBackup实现MySQL的主从复制快速部署【主不锁表】

安装和使用 Percona 推出的 Xtrabackup 备份 MySQL

XtraBackup 的详细介绍:请点这里
XtraBackup 的下载地址:请点这里

请继续阅读:

linux

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How do you alter a table in MySQL using the ALTER TABLE statement? How do you alter a table in MySQL using the ALTER TABLE statement? Mar 19, 2025 pm 03:51 PM

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

How do I configure SSL/TLS encryption for MySQL connections? How do I configure SSL/TLS encryption for MySQL connections? Mar 18, 2025 pm 12:01 PM

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

How do you handle large datasets in MySQL? How do you handle large datasets in MySQL? Mar 21, 2025 pm 12:15 PM

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)? What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)? Mar 21, 2025 pm 06:28 PM

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

How do you drop a table in MySQL using the DROP TABLE statement? How do you drop a table in MySQL using the DROP TABLE statement? Mar 19, 2025 pm 03:52 PM

The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.

How do you represent relationships using foreign keys? How do you represent relationships using foreign keys? Mar 19, 2025 pm 03:48 PM

Article discusses using foreign keys to represent relationships in databases, focusing on best practices, data integrity, and common pitfalls to avoid.

How do you create indexes on JSON columns? How do you create indexes on JSON columns? Mar 21, 2025 pm 12:13 PM

The article discusses creating indexes on JSON columns in various databases like PostgreSQL, MySQL, and MongoDB to enhance query performance. It explains the syntax and benefits of indexing specific JSON paths, and lists supported database systems.

How do I secure MySQL against common vulnerabilities (SQL injection, brute-force attacks)? How do I secure MySQL against common vulnerabilities (SQL injection, brute-force attacks)? Mar 18, 2025 pm 12:00 PM

Article discusses securing MySQL against SQL injection and brute-force attacks using prepared statements, input validation, and strong password policies.(159 characters)

See all articles