文档章节

使用xtrabackup完成远程备份

阿dai
 阿dai
发布于 09/21 00:09
字数 640
阅读 41
收藏 0

转载收藏,以防丢失

需求

Can I backup remote databases from my local server
02-27-2013, 06:17 AM
Hi, 
I am using mysqldump so far for taking daily backups of my Production databases. It takes around 6 to 7 hours for 210 GB of data and thus looking for other backup methods. 

I have one single util server where I run mysqldump for all my production servers with one single script. I store my backup files in the same server. It is really easy to maintain. 

Is that possible with Xtrabackup? Do I have to install and run xtrabackup in all my production servers? I can see there are options to transfer the backup files to any remote server. But I need to know whether I can run xtrabackup from a remote server connecting all my database servers as in mysqldump. 

What are the options for it?


Thanks,
Tags: None

解决办法

I have used XtraBackup to back up remote servers to a local server. In fact I use this method a lot when I want to create a slave in a different geographic location. First I would suggest reading the XtraBackup Manual so you understand the differences between mysqldump and XtraBackup as they are very different.

If you determine you can use XtraBackup in your situation then I can share what I have done in the past in hopes that you can use part of it in your situation.

In this example lets says we have two locations or data centers (DC1 and DC2) and that you have a MySQL server (A) at DC1 that you want to back up to DC2.

Because you want to back up a remote server to a local server, I will assume you may be connected over a VPN (which I have used this method for) or other network link.

I suggest using pigz for compression over gzip as pigz can use multiple processors. So if possible, install pigz on A at DC1 ( google pigz )

We are also going to make use of the "stream" option in XtraBackup and netcat (nc) 

Please read the XtraBackup documentation to make sure you select the correct options for your situation. 

At DC1 on A I run:
innobackupex --user=username --password=password --stream=tar ./ | pigz | nc -l 1234

At DC2 on the server I want to receive the back up at I run in the directory I want to store the back up:
nc 1234 | gunzip | tar ixvf - 2> xtrabackup.log

Note, this will store your entire MySQL data directory uncompressed at DC2 on your back up server. This is useful for creating a slave at DC2 and there are great directions on this in teh Xtrabackup Manual.

I have done this with 600 GB databases in 2-3 hours over a VPN and much quicker on a 1GB network ( where A server had 16 cores). 


You could also just send the file like:

innobackupex --user=username --password=password --stream=tar ./ | pigz | ssh user@dc2_server "cat - > /backupdirectory/mysql_backup.tar.gz"


There are other great options you may need such as --slave-info and --safe-slave-backup and if the locking at the end of the back up is an issue you can use the --no-lock option and then use pt-table-checksum and pt-table-sync after you create your slave to bring it in line with your master. This is a bit more advanced, and while I have done it several times, I used Percona Support to do it! ( worth the investment trust me!)

本文转载自:https://www.percona.com/forums/questions-discussions/percona-xtrabackup/8816-can-i-backup-remote-...

共有 人打赏支持
阿dai
粉丝 68
博文 218
码字总数 289541
作品 0
昌平
运维
私信 提问
mysql备份工具innobackupex,xtrabackup-2.1安装与测试

一、Xtrabackup介绍 1.1:Xtrabackup是什么 Xtrabackup是一个对InnoDB做数据备份的工具,支持在线热备份(备份时不影响数据读写),是商业备份工具InnoDB Hotbackup的一个很好的替代品。 Xtra...

SANSOM
2013/09/10
0
3
编译安装 XtraBackup

文章转自:http://www.themysql.com/mysql/%E7%BC%96%E8%AF%91%E5%AE%89%E8%A3%85xtrabackup.html xtrabackup是percona公司创建并维护的项目,提供innodb引擎的在线备份。 xtrabackup提供了两...

鉴客
2011/08/05
1K
0
逻辑备份mysqldump和物理备份xtrabackup的流程

mysqldump备份原理 备份的基本流程如下: FLUSH TABLES FLUSH TABLES WITH READ LOCK SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ START TRANSACTION WITH CONSISTENT SNAPSHO......

wdw王大为
05/23
0
0
xtrabackup 备份原理

xtraback是物理备份,非阻塞在线实时备份 1.优点: 备份速度很快 备份期间不中断事务 通过压缩节约网络和磁盘 自动备份验证 恢复快 官网提示: Fast and reliable backups Uninterrupted tran...

Lydia_92
06/06
0
0
CentOS 6.5下Percona Xtrabackup的安装错误解决方案

CentOS 6.5下Percona Xtrabackup的安装错误解决方案 CentOS 6.5下Percona Xtrabackup的安装错误解决方案 1.下载最新版的Xtracbackup 2.安装 yum install perl-DBI yum install perl-DBD-MySQ......

xiaocao13140
05/28
0
0

没有更多内容

加载失败,请刷新页面

加载更多

CentOS配置Tomcat监听80端口,虚拟主机

Tomcat更改默认端口为80 更改的配置文件是: /usr/local/tomcat/conf/server.xml [root@test-a ~]# vim /usr/local/tomcat/conf/server.xml # 找到 Connector port="8080" protocol="HTTP/1......

野雪球
30分钟前
2
0
《稻盛和夫经营学》读后感心得体会3180字范文

《稻盛和夫经营学》读后感心得体会3180字范文: 一代日本经营之圣稻盛和夫凭借刻苦勤奋的精神以及深植于佛教的商业道德准则,成为了“佛系”企业家的代表人物。在《稻盛和夫经营学》“领导人...

原创小博客
今天
1
0
java框架学习日志-5(常见的依赖注入)

依赖注入(dependency injection) 之前提到控制反转(Inversion of Control)也叫依赖注入,它们其实是一个东西,只是看的角度不同,这章详细说一下依赖注入。 依赖——指bean对象创建依赖于...

白话
今天
2
0
红外接收器驱动开发

背景:使用系统的红外遥控软件没有反应,然后以为自己接线错误,反复测试,结果烧坏了一个红外接收器,信号主板没有问题。所以自己开发了一个红外接收器的python驱动。接线参见https://my.os...

mbzhong
今天
2
0
ActiveMQ消息传送机制以及ACK机制详解

AcitveMQ是作为一种消息存储和分发组件,涉及到client与broker端数据交互的方方面面,它不仅要担保消息的存储安全性,还要提供额外的手段来确保消息的分发是可靠的。 一. ActiveMQ消息传送机...

watermelon11
今天
2
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部