[聚合文章] RDS全量物理备份谁才能读

MySQL 2017-12-18 22 阅读
有个客户有个需求:想把5.6版本的RDS for MySQL上周的数据呈现出来,和现在的数据进行比对,以进行其他业务操作。那么该怎么办呢?
方法有两个:
1.使用RDS for MySQL自带的方便快捷的恢复方式(克隆实例),可以通过备份集和时间点进行恢复,只需要片刻的时间就完成了。
2.把自动备份(物理备份)下载下来,然后在ECS自建MySQL的server端上读取这部分数据。
相对于方法1,方法2更加麻烦一些,但是可以节省一些支出。
针对这个客户的现状,当然首推方法1,难度很低,很快捷。但是客户选择方法2。那么问题来了:什么版本的MySQL的server才能读取RDS上物理备份的数据呢。
因为RDS是5.6的,所以客户选择了5.6.38这个版本的MySQL,安装完成登陆之后发现数据库上是有这些表的名称,但是select时总是处出现ERROR 1146 (42S02)的报错,百度之后网上给的解释是共享表空间ibdata1文件也要copy过去,但是RDS自然不用考虑这个问题。那么会是什么问题呢?
自己亲自测试一下:
MySQL5.6.38
[root@172-16-10-204 /data/alisql/data] #mysql -uroot -h127.0.0.1 -P3308
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.6.38 MySQL Community Server (GPL)
Copyright (c) 2000, 2017, 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.

root@(none) 05:51:46>use ceshi;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed

root@ceshi 05:51:51>show tables;
+-----------------+
| Tables_in_ceshi |
+-----------------+
| c1              |
| c2              |
| student1        |
| test            |
+-----------------+
4 rows in set (0.00 sec)

root@ceshi 05:51:53>select * from c1;
ERROR 1146 (42S02): Table 'ceshi.c1' doesn't exist
MySQL5.6的版本可以正常启动,但是就是无法读取表的数据。用mysql_upgrade的时候会报错,显示mysql库内的许多表都不存在,一时很是疑惑。既然5.6的不行,索性就使用5.7的尝试一下吧:

MySQL5.7.20
[root@172-16-10-204 /root]
#mysql -uroot -h127.0.0.1 -P3308
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 5.7.20 MySQL Community Server (GPL)
Copyright (c) 2000, 2017, 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.

root@(none) 05:56:05>use ceshi;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed

root@ceshi 05:56:12>select * from c1;
+------+------+------+------+
| a    | b    | c    | d    |
+------+------+------+------+
|    2 |    1 |    2 | NULL |
|    4 |    4 |    4 | NULL |
|    5 |    5 |    5 | NULL |
|    6 |    6 |    6 | NULL |
|    7 |    7 |    7 | NULL |
|    8 |    8 |    8 | NULL |
|    9 |    9 |    9 | NULL |
|   10 |   10 |   10 | NULL |
|    1 |    1 |    1 | NULL |
+------+------+------+------+
9 rows in set (0.00 sec)
结果还是既是意料之外,又是情理之中的,因为RDS for MySQL虽然是5.6的版本,但是这不是原生纯正的MySQL,而是阿里巴巴修改过源码的alisql,里面加了许多5.7的功能,所以用5.6的版本再去读取这部分数据的时候可能不会那么完美的兼容。
总结:小版本更迭时,底层文件没有太大的差异,server层可能会继续使用这部分数据。大版本的更迭:1.如果是高版本server读取低版本的全量物理备份的时候,大概率是可以读取的(不是必然)。2.如果是低版本server读取高版本的全量物理备份的时候,大概率是不可以读取的(不是必然)。
本文为云栖社区原创内容,未经允许不得转载,如需转载请发送邮件至yqeditor@list.alibaba-inc.com;如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件至:yqgroup@service.aliyun.com 进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容。

用云栖社区APP,舒服~

【云栖快讯】中办国办印发《推进互联网协议第六版(IPv6)规模部署行动计划》加快推进基于 IPv6 的下一代互联网规模部署,计划指出2025年末中国 IPv6 规模要达到世界第一,阿里云也第一时间宣布了将全面提供IPv6服务,那么在全面部署 IPV6 前,你需要了解都在这儿  详情请点击

注:本文内容来自互联网,旨在为开发者提供分享、交流的平台。如有涉及文章版权等事宜,请你联系站长进行处理。