xtrabackup之Innobackupex全备数据库
一、Xtrabackup是什么:
- Xtrabackup是一个对InnoDB做数据备份的工具,支持在线热备份(备份时不影响数据读写),是商业备份工具InnoDB Hotbackup的一个很好的替代品。
- Xtrabackup有两个主要的工具:xtrabackup、innobackupex
- xtrabackup只能备份InnoDB和XtraDB两种数据表,而不能备份MyISAM数据表
- innobackupex是参考了InnoDB Hotbackup的innoback脚本修改而来的.innobackupex是一个perl脚本封装,封装了xtrabackup。主要是为了方便的 同时备份InnoDB和MyISAM引擎的表,但在处理myisam时需要加一个读锁。并且加入了一些使用的选项。如slave-info可以记录备份恢 复后,作为slave需要的一些信息,根据这些信息,可以很方便的利用备份来重做slave。
二、利用二进制包安装xtrabackup
[root@DBMysql ~]# tar xvfz percona-xtrabackup-2.0.-.tar.gz -C /usr/local
[root@DBMysql local]# mv percona-xtrabackup-2.0. xtrabackup
[root@DBMysql local]# chown mysql:mysql -R /usr/local/xtrabackup/ 在mysql用户下的 .bash_profile文件中添加环境变量
export PATH=/usr/local/xtrabackup/bin:$PATH
三、创建备份专用账户
[mysql@DBMysql ~]$ mysql --defaults-file=/mysql/mysqldata//my.cnf -usystem -p''
[(none) ::]>create user xtrabk@'127.0.0.1' identified by 'onlybackup';
Query OK, rows affected (0.08 sec) [(none) ::]>grant reload,lock tables,Replication client, super on *.* to xtrabk@'127.0.0.1';
Query OK, rows affected (0.07 sec)
[(none) ::]>
四.innobackupex全量备份
[mysql@hadoop1 ~]$ innobackupex --defaults-file=/mysql/mysqldata//my.cnf --host=127.0.0.1 --user=xtrabk --password='onlybackup' /mysql/mysqldata/backup/3306_full InnoDB Backup Utility v1.5.1-xtrabackup; Copyright , Innobase Oy
and Percona Ireland Ltd -. All Rights Reserved. This software is published under
the GNU GENERAL PUBLIC LICENSE Version , June . :: innobackupex: Starting mysql with options: --defaults-file='/mysql/mysqldata/3306/my.cnf' --password=xxxxxxxx --user='xtrabk' --host='127.0.0.1' --unbuffered --
:: innobackupex: Connected to database with mysql child process (pid=)
:: innobackupex: Connection to database server closed
IMPORTANT: Please check that the backup run completes successfully.
At the end of a successful backup run innobackupex
prints "completed OK!". innobackupex: Using mysql Ver 14.12 Distrib 5.0., for redhat-linux-gnu (x86_64) using readline 5.1
innobackupex: Using mysql server version Copyright (c) , , Oracle and/or its affiliates. All rights reserved. innobackupex: Created backup directory /mysql/mysqldata/backup/3306_full/--27_00--
:: innobackupex: Starting mysql with options: --defaults-file='/mysql/mysqldata/3306/my.cnf' --password=xxxxxxxx --user='xtrabk' --host='127.0.0.1' --unbuffered --
:: innobackupex: Connected to database with mysql child process (pid=)
:: innobackupex: Connection to database server closed :: innobackupex: Starting ibbackup with command: xtrabackup_56 --defaults-file="/mysql/mysqldata/3306/my.cnf" --defaults-group="mysqld" --backup --suspend-at-end --target-dir=/mysql/mysqldata/backup/3306_full/--27_00-- --tmpdir=/mysql/mysqldata//tmp
innobackupex: Waiting for ibbackup (pid=) to suspend
innobackupex: Suspend file '/mysql/mysqldata/backup/3306_full/2016-05-27_00-23-05/xtrabackup_suspended' xtrabackup_56 version 2.0. for MySQL server 5.6. Linux (x86_64) (revision id: )
xtrabackup: uses posix_fadvise().
xtrabackup: cd to /mysql/mysqldata//data
xtrabackup: Target instance is assumed as followings.
xtrabackup: innodb_data_home_dir = ./
xtrabackup: innodb_data_file_path = ibdata01:100M:autoextend
xtrabackup: innodb_log_group_home_dir = /mysql/mysqldata//redo
xtrabackup: innodb_log_files_in_group =
xtrabackup: innodb_log_file_size =
xtrabackup: using O_DIRECT
InnoDB: Allocated tablespace , old maximum was
InnoDB: Opened undo tablespaces
>> log scanned up to ()
[] Copying ./ibdata01 to /mysql/mysqldata/backup/3306_full/--27_00--/ibdata01
>> log scanned up to ()
[] ...done
[] Copying ./mysql/innodb_table_stats.ibd to /mysql/mysqldata/backup/3306_full/--27_00--/mysql/innodb_table_stats.ibd
>> log scanned up to ()
[] ...done
[] Copying ./mysql/innodb_index_stats.ibd to /mysql/mysqldata/backup/3306_full/--27_00--/mysql/innodb_index_stats.ibd
[] ...done
[] Copying ./mysql/slave_relay_log_info.ibd to /mysql/mysqldata/backup/3306_full/--27_00--/mysql/slave_relay_log_info.ibd
[] ...done
[] Copying ./mysql/slave_master_info.ibd to /mysql/mysqldata/backup/3306_full/--27_00--/mysql/slave_master_info.ibd
[] ...done
[] Copying ./mysql/slave_worker_info.ibd to /mysql/mysqldata/backup/3306_full/--27_00--/mysql/slave_worker_info.ibd
[] ...done
[] Copying ./pls_innodb/t_polestar02.ibd to /mysql/mysqldata/backup/3306_full/--27_00--/pls_innodb/t_polestar02.ibd
[] ...done
[] Copying /mysql/mysqldata//undo/undo001 to /mysql/mysqldata/backup/3306_full/--27_00--/undo001
[] ...done
[] Copying /mysql/mysqldata//undo/undo002 to /mysql/mysqldata/backup/3306_full/--27_00--/undo002
[] ...done
[] Copying /mysql/mysqldata//undo/undo003 to /mysql/mysqldata/backup/3306_full/--27_00--/undo003
[] ...done
[] Copying /mysql/mysqldata//undo/undo004 to /mysql/mysqldata/backup/3306_full/--27_00--/undo004
>> log scanned up to ()
[] ...done
[] Copying /mysql/mysqldata//undo/undo005 to /mysql/mysqldata/backup/3306_full/--27_00--/undo005
[] ...done
>> log scanned up to () :: innobackupex: Continuing after ibbackup has suspended
:: innobackupex: Starting mysql with options: --defaults-file='/mysql/mysqldata/3306/my.cnf' --password=xxxxxxxx --user='xtrabk' --host='127.0.0.1' --unbuffered --
:: innobackupex: Connected to database with mysql child process (pid=)
>> log scanned up to ()
>> log scanned up to ()
:: innobackupex: Starting to lock all tables...
>> log scanned up to ()
>> log scanned up to ()
>> log scanned up to ()
>> log scanned up to ()
>> log scanned up to ()
>> log scanned up to ()
>> log scanned up to ()
>> log scanned up to ()
>> log scanned up to ()
>> log scanned up to ()
:: innobackupex: All tables locked and flushed to disk :: innobackupex: Starting to backup non-InnoDB tables and files
innobackupex: in subdirectories of '/mysql/mysqldata/3306/data'
innobackupex: Backing up files '/mysql/mysqldata/3306/data/mysql/*.{frm,isl,MYD,MYI,MAD,MAI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}' ( files)
innobackupex: Backing up files '/mysql/mysqldata/3306/data/performance_schema/*.{frm,isl,MYD,MYI,MAD,MAI,MRG,TRG,TRN,ARM,ARZ,CSM,CSV,opt,par}' ( files)
innobackupex: Backing up file '/mysql/mysqldata/3306/data/pls_innodb/db.opt'
innobackupex: Backing up file '/mysql/mysqldata/3306/data/pls_innodb/t_polestar02.frm'
innobackupex: Backing up file '/mysql/mysqldata/3306/data/pls_myisam/t_polestar01.MYD'
innobackupex: Backing up file '/mysql/mysqldata/3306/data/pls_myisam/db.opt'
innobackupex: Backing up file '/mysql/mysqldata/3306/data/pls_myisam/t_polestar01.MYI'
innobackupex: Backing up file '/mysql/mysqldata/3306/data/pls_myisam/t_polestar01.frm'
:: innobackupex: Finished backing up non-InnoDB tables and files :: innobackupex: Waiting for log copying to finish xtrabackup: The latest check point (for incremental): ''
xtrabackup: Stopping log copying thread.
.>> log scanned up to () xtrabackup: Transaction log of lsn () to () was copied.
:: innobackupex: All tables unlocked
:: innobackupex: Connection to database server closed innobackupex: Backup created in directory '/mysql/mysqldata/backup/3306_full/2016-05-27_00-23-05'
innobackupex: MySQL binlog position: filename 'mysql-bin.000003', position
:: innobackupex: completed OK!
[mysql@hadoop1 ~]$
五、innobackupexe备份产生的相关文件
[mysql@hadoop1 --27_00--]$ ls -l
total
-rw-rw-r-- mysql mysql May : backup-my.cnf
-rw-rw---- mysql mysql May : ibdata01
drwx------ mysql mysql May : mysql
drwxrwxr-x mysql mysql May : performance_schema
drwx------ mysql mysql May : pls_innodb
drwxrwxr-x mysql mysql May : pls_myisam
drwxrwxr-x mysql mysql May : test
-rw-rw---- mysql mysql May : undo001
-rw-rw---- mysql mysql May : undo002
-rw-rw---- mysql mysql May : undo003
-rw-rw---- mysql mysql May : undo004
-rw-rw---- mysql mysql May : undo005
-rw-rw-r-- mysql mysql May : xtrabackup_binary
-rw-rw-r-- mysql mysql May : xtrabackup_binlog_info
-rw-rw---- mysql mysql May : xtrabackup_checkpoints
-rw-rw---- mysql mysql May : xtrabackup_logfile
[mysql@hadoop1 --27_00--]$
xtrabackup之Innobackupex全备数据库的更多相关文章
- Innobackupex 全备数据库
对于MySQL数据库的热备.xtrabackup是除了MySQL enterprise backup之外的不二之选. 该工具提供了基于innodb存储引擎的热备.支持全量,增量备份,部分备份,时点恢复 ...
- xtrabackup之Innobackupex全备恢复
一.当前环境 [mysql@hadoop1 ~]$ mysql --defaults-/my.cnf -uroot -p123456 -P3306 mysql> show variables l ...
- MySQL5.7.18 备份、Mysqldump,mysqlpump,xtrabackup,innobackupex 全量,增量备份,数据导入导出
粗略介绍冷备,热备,温暖,及Mysqldump,mysqlpump,xtrabackup,innobackupex 全量,增量备份 --备份的目的 灾难恢复:意外情况下(如服务器宕机.磁盘损坏等)对损 ...
- 每天进步一点点——mysql——Percona XtraBackup(innobackupex)
一. 简单介绍 Percona XtraBackup是开源免费的MySQL数据库热备份软件,它能对InnoDB和XtraDB存储引擎的数据库非堵塞地备份(对于MyISAM的备份相同须要加表锁).Xt ...
- xtrabackup备份还原mariadb数据库
一.xtrabackup 简介 xtrabackup 是由percona公司开源免费的数据库热备软件,它能对InnoDB数据库和XtraDB存储引擎的数据库非阻塞地备份,对于myisam的备份同样需要 ...
- Xtrabackup之innobackupex备份恢复详解(转)
add by zhj:对于Xtrabackup2.2来说,已经解决了本文结尾提到的那个bug,当使用--copy-back时,同时加--force-non-empty-directories 即可.这 ...
- Percona Xtrabackup备份mysql大数据库(完整备份与增量备份)
Percona Xtrabackup备份mysql大数据库(完整备份与增量备份) 文章目录 [隐藏] Xtrabackup简介 Xtrabackup安装 Xtrabackup工具介绍 inno ...
- 通过xtrabackup工具对mysql数据库做全备
需求描述: 使用xtrabackup工具对mysql实例中的所有的数据库进行备份,并且将备份的过程输出到指定的日志文件中. 操作过程: 1.使用xtrabacup工具备份mysql实例 xtrabac ...
- Innobackupex全备恢复(原理、演示)
一. Innobackupex恢复原理 After creating a backup, the data is not ready to be restored. There might b ...
随机推荐
- 安装 chardet ,出现ImportError: No module named setuptools
原因:在linux的机子上没有setuptools 可能此机子上的python版本过低 http://www.cnblogs.com/kkgreen/archive/2012/08/02/262042 ...
- jmeter随笔(10)-中文url编码问题
坚持分享,坚持总结,技术需要时间的积累和练习,对jmeter实践的点滴的记录,这里分享交流,仅供参考和讨论,有想法的欢迎留言.谈论,手机上图片如果不清晰,请点击[阅读原文]查看. 1技巧1:后台数据h ...
- Vertex中实现每顶点光照的镜面高光效果
1,基础知识讲解 一个物体在自然界会收到三种光的影响,周围的环境光.漫反射和镜面反射.那么对于计算机要想模拟现实中的光照,就应该也会实现这三种基本光照->环境光.漫反射.镜面高光.对于这三种光照 ...
- nginx 代理配置文件实例
安装NGINX前要先安装PCRE正则表达式库: ./configure --prefix=/usr/local/pcre 出现以下错误 (一般./configure即可, 笔者这里是直接./conf ...
- Stay Hungry
保持饥饿,从身体上来说,可以随时保持机动状态,所以,今天的早饭.午饭.晚饭,我都没有吃到饱.等到想要放松的时候,就饱餐一顿,未必不是一种幸福!精神上,保持饥饿,我还不清楚是一种什么样的状态,自然也描述 ...
- ApplePay
ApplePay要在项目有里配置,,配置好项目之后,就剩下编码了,做ApplePay首先要检查设备是否支持ApplePay,支持 ApplePay的设备在 iPhone6及以后, PKPayment ...
- jQuery Mask
<script type="text/javascript" src="/assets/mask/jquery.mask.min.js"></ ...
- 关于hook d3d在war3上绘图的几点疑问
学到了. 你得记住,com接口全是stdcall调用方式,不是thiscall,不要搞错了,不信,你看接口定义 因为com调用得兼容c调用,而c没有thiscall调用方式stdcall时,this指 ...
- leetcode279. Perfect Squares
learn from DP class Solution { public: int numSquares(int n) { if(n<=0)return 0; int * dp = new i ...
- AX 利用windows粘贴板功能实现批量数据快速导出EXCEL
static void test(Args _args) { int lineNum; int titleLines; SysExcelApplication excel; SysExcelWorkb ...