温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

安装和测试xtrabackup8.0

发布时间:2020-07-22 22:45:26 来源:网络 阅读:556 作者:wuhui66 栏目:MySQL数据库

安装和测试xtrabackup8.0
Xtrabackup 2.4.已经不支持MySQL 8.0的备份恢复,使用会报如下错误!
Error: MySQL 8.0 and Percona Server 8.0 are not supported by Percona Xtrabackup 2.4.x series. Please use Percona Xtrabackup 8.0.x for backups and restores.
mysql8.0
[root@enbao ~]# clear
[root@enbao ~]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
安装percona-xtrabackup-80
[root@enbao soft]# yum -y install percona-xtrabackup-80-8.0.7-1.el7.x86_64.rpm
Installed:
percona-xtrabackup-80.x86_64 0:8.0.7-1.el7

Complete!
查看安装后结果,发现已经没有innobackupex命令
[root@enbao soft]# rpm -ql percona-xtrabackup-80-8.0.7-1.el7.x86_64
/usr/bin/xbcloud
/usr/bin/xbcloud_osenv
/usr/bin/xbcrypt
/usr/bin/xbstream
/usr/bin/xtrabackup
/usr/lib64/xtrabackup/plugin/keyring_file.so
/usr/lib64/xtrabackup/plugin/keyring_vault.so
/usr/share/doc/percona-xtrabackup-80-8.0.7
/usr/share/doc/percona-xtrabackup-80-8.0.7/LICENSE
/usr/share/man/man1/xbcrypt.1.gz
/usr/share/man/man1/xbstream.1.gz
/usr/share/man/man1/xtrabackup.1.gz
备份3306实例并恢复回3306
创建测试数据
root@enbao 09:56: [enbao]> create database test;
Query OK, 1 row affected (0.06 sec)

root@enbao 09:57: [enbao]> use test;
Database changed
root@enbao 09:57: [test]> create table t1(id int(10) NOT NULL AUTO_INCREMENT,name varchar(20),primary key(id));
Query OK, 0 rows affected, 1 warning (0.09 sec)
root@enbao 09:59: [test]> insert into t1(name) values('a'),('b'),('c');
Query OK, 3 rows affected (0.09 sec)
Records: 3 Duplicates: 0 Warnings: 0

root@enbao 10:00: [test]> select * from t1;
+----+------+
| id | name |
+----+------+
| 1 | a |
| 2 | b |
| 3 | c |
+----+------+
3 rows in set (0.00 sec)
创建备份目录
[root@enbao data]# mkdir -p /data/backup/
1.xtrabackup --defaults-file=/data/mysql/my3306.cnf -S /data/mysql/mysql3306.sock -uroot -proot123 --backup --no-timestamp --target-dir=/data/backup/db3306_date +%Y%m%d

  1. shutdown 原实例,冷备份原来数据
    [root@enbao soft]# mysqladmin -uroot -proot123 shutdown
    mv mysql3306 mysql3306_bak
  2. mkdir mysql3306/{data,logs,tmp} -p
    进行数据恢复
  3. xtrabackup --defaults-file=/data/mysql/my3306.cnf --copy-back --target-dir=/data/backup/db3306_20191027/
    更改目录权限
  4. chown -R mysql:mysql mysql3306
  5. /usr/local/mysql/bin/mysqld --defaults-file=/data/mysql/my3306.cnf &
    查看error日志是否有错误,登录到数据库验证可用性!
    [root@enbao logs]# grep -i "error" /data/mysql/mysql3306/logs/error.log
    2019-10-27T10:37:35.389830-04:00 1 [ERROR] [MY-011971] [InnoDB] Tablespace 'innodb_system' Page [page id: space=0, page number=5] log sequence number 29956511 is in the future! Current system log sequence number 29861388.
    2019-10-27T10:37:35.389873-04:00 1 [ERROR] [MY-011972] [InnoDB] Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to http://dev.mysql.com/doc/refman/8.0/en/forcing-innodb-recovery.html for information about forcing recovery.
    [root@enbao logs]# mysql -S /data/mysql/mysql3306.sock -p
    Enter password:
    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 9
    Server version: 8.0.17 MySQL Community Server - GPL
    root@enbao 11:01: [test]> select * from t1;
    +----+------+
    | id | name |
    +----+------+
    | 1 | a |
    | 2 | b |
    | 3 | c |
    +----+------+
    3 rows in set (0.00 sec)

root@enbao 11:01: [test]> insert into t1(name) values('d'),('e');
Query OK, 2 rows affected (0.04 sec)
Records: 2 Duplicates: 0 Warnings: 0

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI