当前位置:网站首页>xtrabackup做数据备份
xtrabackup做数据备份
2022-06-24 07:04:00 【一个不靠谱的程序员】
xtrabackup
XtraBackup(PXB) 工具是 Percona 公司用 perl 语言开发的一个用于 MySQL 数据库物理热备的备份工具,支持 MySQl(Oracle)、Percona Server 和 MariaDB,并且全部开源,真可谓是业界良心。阿里的 RDS MySQL 物理备份就是基于这个工具做的。由于是采取物理拷贝的方式来做的备份,所以速度非常快,几十G数据几分钟就搞定了,而它巧妙的利用了mysql 特性做到了在线热备份,不用像以前做物理备份那样必须关闭数据库才行,直接在线就能完成整库或者是部分库的全量备份和增量备份。
安装
安装仓库Install the Percona repository
yum install http://www.percona.com/downloads/percona-release/redhat/0.1-6/percona-release-0.1-6.noarch.rpm测试一下仓库里是否含有最新版的资源
yum list | grep percona安装packages
yum install percona-xtrabackup-24
数据备份
- 全量备份
innobackupex ----defaults-file=/etc/my.cnf --user=root --password=root /root/back
数据恢复
关闭数据库服务
service mysql stop执行数据恢复命令*(注意my.cnf里配置的datadir目录必须是一个空目录,因此在恢复数据之前,要先datadir到别的目录,然后新建一个空目录再执行恢复)
innobackupex --defaults-file=/etc/my.cnf --copy-back --rsync /path/to/backup给新建的目录变更权限
chown -R mysql. /app/mysql/data启动mysql服务
service mysql start
边栏推荐
- Redis cluster data skew
- Detailed explanation of etcd backup and recovery principle and actual record of stepping on the pit
- uniapp 热更新后台管理
- JS merge multiple objects and remove duplicates
- App Startup
- 分布式 | 如何与 DBLE 进行“秘密通话”
- Easycvr invokes the interface parameter acquisition method and precautions of device video recording on the page
- How to mount a USB hard disk with NTFS file format under RHEL5 system
- Base64编码详解及其变种(解决加号在URL变空格问题)
- JS to get the last element of the array
猜你喜欢

ZUCC_ Principles of compiling language and compilation_ Experiment 02 fsharp Ocaml language

12-- merge two ordered linked lists

The article takes you to understand the security of Windows operating system and protect your computer from infringement

js中通过key查找和更新对象中指定值的方法

【微服务~Nacos】Nacos服务提供者和服务消费者

Longhorn installation and use

List of Li Bai's 20 most classic poems

How to improve the customer retention rate in the operation of independent stations? Customer segmentation is very important!

ZUCC_编译语言原理与编译_实验03 编译器入门

分布式 | 如何与 DBLE 进行“秘密通话”
随机推荐
Three categories of financial assets under the new standards: AMC, fvoci and FVTPL
Three ways to uninstall Symantec Endpoint Protection Symantec
ZUCC_ Principles of compiling language and compilation_ Experiment 01 language analysis and introduction
Application of tidb in Netease games
Pyqt common system events
ZUCC_编译语言原理与编译_大作业
ZUCC_ Principles of compiling language and compilation_ Experiment 08 parsing LR parsing
2021-03-09 comp9021 class 7 Notes
Question 4 - datepicker date selector, disabling two date selectors (start and end dates)
13 -- remove invalid parentheses
Maya re deployment
[acnoi2022] not a structure, more like a structure
Base64编码详解及其变种(解决加号在URL变空格问题)
orb slam build bug: undefined reference to symbol ‘_ZN5boost6system15system_categoryEv‘
Easycvr invokes the interface parameter acquisition method and precautions of device video recording on the page
普通token
Two methods of QT exporting PDF files
Small sample fault diagnosis - attention mechanism code - Implementation of bigru code parsing
Building a static website with eleventy
"Wechat cloud hosting" first practical battle | introduction to minimalist demo