码迷,mamicode.com
首页 > 数据库 > 详细

配置ECS上自建MySQL作为RDS从库过程中踩到的坑

时间:2017-06-05 22:12:43      阅读:1090      评论:0      收藏:0      [点我收藏+]

标签:rds ecs change master 失败

环境:

  RDS版本:阿里云的5.6

  ECS自建MySQL5.6.34(官方版本)


通过将阿里云rds的自动全量备份下载到ECS上,按照官方的步骤解压--> aploy-log ---> mv 到mysql的datadir 并启动mysql。


然后执行

reset slave all;

reset master;


change master to master_host=‘rm-xxxxxxxxx.mysql.rds.aliyuncs.com‘,

master_user=‘rpl‘, 

master_password=‘123456‘ , 

MASTER_PORT=3306, 

MASTER_AUTO_POSITION=1; 

这里就报错了。错误日志提示:

2017-06-05 16:35:19 16759 [ERROR] Error reading relay log configuration.

2017-06-05 16:37:00 16759 [ERROR] Error reading master configuration.



原因:

 阿里云的RDS是做个修改的版本,和官方部分表结构的不一样。(目前发现的有mysql库下面的slave_master_info、slave_relay_log_info、slave_worker_info,其他的表还没仔细关注)

RDS恢复出来的这3张表里面,比官方的版本多了个Channel_name字段。导致我们change master失败。

下图是我在编译的alisql上面查看的表结构:

技术分享



解决方法:

use mysql;

drop table slave_master_info;

drop table slave_relay_log_info;

drop table slave_worker_info;

然后参照其他MySQL5.6的机器,重新建这3张表。


完成后,再按照常规的GTID复制的从库搭建步骤操作:

change master to master_host=‘rm-xxxxxxxxxxx.mysql.rds.aliyuncs.com‘,

master_user=‘rpl‘, 

master_password=‘rpl‘ , 

MASTER_PORT=3306, 

MASTER_AUTO_POSITION=1; 


SET GLOBAL gtid_purged=‘b9f0343a-3ac4-11e7-9769-008cfaf59624:1-6751, d50b0441-3ac4-11e7-976a-7cd30ac47780:1-106693‘;


start salve;

这样就可以自动开始同步数据了。



(如果用编译安装的alisql则不需要这几步骤,因为阿里云开源出来的ALiSQL和RDS都有Channel_name字段)


本文出自 “菜鸡” 博客,请务必保留此出处http://lee90.blog.51cto.com/10414478/1932485

配置ECS上自建MySQL作为RDS从库过程中踩到的坑

标签:rds ecs change master 失败

原文地址:http://lee90.blog.51cto.com/10414478/1932485

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!