当前位置:网站首页>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
边栏推荐
- App Startup
- Detailed explanation of etcd backup and recovery principle and actual record of stepping on the pit
- Shell basic operator -- arithmetic operator
- Export MySQL database to xxx SQL, set xxx The SQL file is imported into MySQL on the server. Project deployment.
- 5分钟,客服聊天处理技巧,炉火纯青
- LabVIEW finds prime numbers in an array of n elements
- ZUCC_编译语言原理与编译_实验08 语法分析 LR 分析
- 5 minutes, excellent customer service chat handling skills
- Variable declaration and some special variables in shell
- [untitled]
猜你喜欢

LabVIEW finds prime numbers in an array of n elements

jwt(json web token)

List of Li Bai's 20 most classic poems

A preliminary study of IO model

12-- merge two ordered linked lists

新技术实战,一步步用Activity Results API封装权限申请库

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

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

5分钟,客服聊天处理技巧,炉火纯青

Two methods of QT exporting PDF files
随机推荐
Longhorn installation and use
Vscode install the remote -wsl plug-in to connect to the local WSL
Battle history between redis and me under billion level traffic
Glusterfs replacement failure brick
Several ways you can't move zero (sequel)
leetcode 1268. Search Suggestions System(搜索推荐系统)
13 -- remove invalid parentheses
5 minutes, excellent customer service chat handling skills
2021-06-24: find the length of the longest non repeating character substring in a string.
获取屏幕宽高工具类
Rescue system -- the application of read-write separation
JUC personal simple notes
Common misconceptions in Tencent conference API - signature error_ code 200003
Opencv get (propid) common values
Promise的使用場景
Scénarios d'utilisation de la promesse
[micro services ~nacos] Nacos service providers and service consumers
io模型初探
[acnoi2022] I have done it, but I can't
独立站运营中如何提升客户留存率?客户细分很重要!