Mysql8.0.21+Percona XtraBackup 8.0.14热备份与恢复操作详解

准备2台虚拟机一主一从 mysql安装版本Mysql8.0.21, percona-xtrabackup-80-8.0.14-1.el7.x86_64.rpm 

主192.168.24.131 master

从192.168.24.133 slave

Percona XtraBackup 8.0.14, 安装与测试

下载地址命令

wget https://downloads.percona.com/downloads/Percona-XtraBackup-LATEST/Percona-XtraBackup-8.0.14/binary/redhat/7/x86_64/percona-xtrabackup-80-8.0.14-1.el7.x86_64.rpm

 

yum localinstall percona-xtrabackup-80-8.0.14-1.el7.x86_64.rpm
[root@localhost file]# xtrabackup

 开始进行备份操作,进入 主库 中

 

xtrabackup --defaults-file=/etc/my.cnf --user=root --password=root --port=3306 --backup --target-dir=/home/master_slave

主库备份完成

向从库传输数据

 

进入从库节目

已经传输过来了。看下从的数据库,没操做之前的样子

 

关闭从库mysql

[root@localhost home]# service mysql status
 SUCCESS! MySQL running (25415)
[root@localhost home]# service mysql stop
Shutting down MySQL........ SUCCESS! 
[root@localhost home]# mv /usr/local/mysql/data /usr/local/mysql/data2
[root@localhost home]# xtrabackup --defaults-file=/etc/my.cnf --copy-back --target-dir=/home/master_slave

 

 

[root@localhost home]# cd /usr/local/mysql/
 

[root@localhost mysql]# chown -R mysql:mysql /usr/local/mysql/data
 

重启从库mysql

[root@localhost mysql]# service mysql start
Starting MySQL.Logging to '/usr/local/mysql/data/data.err'.
................ SUCCESS! 
[root@localhost mysql]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.21 MySQL Community Server - GPL

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| goods              |
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
5 rows in set (0.00 sec)

 

 

备份完成!!!!!!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值