Chinaunix首页 | 论坛 | 博客
  • 博客访问: 24046
  • 博文数量: 2
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 20
  • 用 户 组: 普通用户
  • 注册时间: 2014-09-19 13:00
文章分类

全部博文(2)

文章存档

2015年(2)

我的朋友

分类: Mysql/postgreSQL

2015-08-20 16:55:47

xtrabackup 热备份mysql 数据库 innodb引擎
 
简介
    数据库作为数据持久化的地方,对7*24小时的运行有超高的要求。
mysql 作为rdbms里开源数据库里使用最多的数据库。热备份也是不可缺少的。
   Xtrabackup是一个对InnoDB做数据备份的工具,支持在线热备份(备份时不影响数据读写),是商业备份工具InnoDB Hotbackup的一个很好的替代品。
  Xtrabackup有两个主要的工具:xtrabackup、innobackupex
  (1)xtrabackup只能备份InnoDB和XtraDB两种数据表,而不能备份MyISAM数据表
  (2)innobackupex-1.5.1则封装了xtrabackup,是一个脚本封装,所以能同时备份处理innodb和myisam,但在处理myisam时需要加一个读锁

安装
 

     一 下载 Xtrabackup

   

     网址: style="color:#000000;">

 













   选择你需要的版本,上传到你的虚拟机,或者服务器。


percona-xtrabackup-2.2.9-5067-Linux-x86_64.tar.gz

  解压安装包 
[root@localhost mysql]# tar -zxvf percona-xtrabackup-2.2.9-5067-Linux-x86_64.tar.gz 


创建用户 
 
mysql -uroot --password="" -e"CREATE USER 'backup'@'192.168.%' IDENTIFIED BY '123456'";
mysql -uroot --password="" -e “GRANT CREATE, RELOAD, LOCK TABLES, REPLICATION CLIENT ON *.* TO 'backup'@'%'”;

修改环境变量 增加 xtrabackup
测试备份  
xtrabackup --defaults-file=/etc/my.cnf --user=backup --password="123456"--port=3306 --backup --target-dir=/zx/mysql/full_incre_20150820


[root@localhost mysql]# xtrabackup --defaults-file=/etc/my.cnf --user=backup --password="123456"--port=3306 --backup --target-dir=/zx/mysql/full_incre_20150820
xtrabackup version 2.2.9 based on MySQL server 5.6.22 Linux (x86_64) (revision id: )
xtrabackup: uses posix_fadvise().
xtrabackup: cd to /var/mysql/data
xtrabackup: open files limit requested 0, set to 1024
xtrabackup: using the following InnoDB configuration:
xtrabackup:   innodb_data_home_dir = ./
xtrabackup:   innodb_data_file_path = ibdata1:10M:autoextend
xtrabackup:   innodb_log_group_home_dir = ./
xtrabackup:   innodb_log_files_in_group = 2
xtrabackup:   innodb_log_file_size = 104857600
xtrabackup: Can't create/write to file '/zx/mysql/full_incre_20150820/xtrabackup_logfile' (Errcode: 17 - File exists)
xtrabackup: error: failed to open the target stream for 'xtrabackup_logfile'.
[root@zhangxu-dba-test-61cc67a0-96f1-4a5a-ab88-e36f86dbceb0 mysql]# xtrabackup --defaults-file=/etc/my.cnf --user=backup --password="123456"--port=3306 --backup --target-dir=/zx/mysql/full_incre_20150821
xtrabackup version 2.2.9 based on MySQL server 5.6.22 Linux (x86_64) (revision id: )
xtrabackup: uses posix_fadvise().
xtrabackup: cd to /var/mysql/data
xtrabackup: open files limit requested 0, set to 1024
xtrabackup: using the following InnoDB configuration:
xtrabackup:   innodb_data_home_dir = ./
xtrabackup:   innodb_data_file_path = ibdata1:10M:autoextend
xtrabackup:   innodb_log_group_home_dir = ./
xtrabackup:   innodb_log_files_in_group = 2
xtrabackup:   innodb_log_file_size = 104857600
>> log scanned up to (29108748)
xtrabackup: Generating a list of tablespaces
[01] Copying ./ibdata1 to /zx/mysql/full_incre_20150821/ibdata1
>> log scanned up to (29108748)
>> log scanned up to (29108748)
[01]        ...done
>> log scanned up to (29108748)
xtrabackup: The latest check point (for incremental): '29108748'
xtrabackup: Stopping log copying thread.
.>> log scanned up to (29108748)


xtrabackup: Transaction log of lsn (29108748) to (29108748) was copied.



安装 完成  谢谢大家关注 公众号


阅读(3031) | 评论(0) | 转发(0) |
0

上一篇:解析mysql与oracle 体系结构

下一篇:没有了

给主人留下些什么吧!~~