Chinaunix首页 | 论坛 | 博客
  • 博客访问: 5317
  • 博文数量: 1
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 0
  • 用 户 组: 普通用户
  • 注册时间: 2015-09-21 15:44
文章分类

全部博文(1)

文章存档

2015年(1)

我的朋友
最近访客

分类: Mysql/postgreSQL

2015-09-21 15:44:49

     5.6之前的mysql版本master info logrelay log info log,都是存储在文件master.info和relay-log.info中。但这个对于服务器掉电的问题,是不能保证relay log info 一致性,为了保证这个crash-safe。5.6推荐一种新的保障方式,把master.info和relay-log.info保存在两张表中。
    两张表是mysql.slave_master_info和mysql.slave_relay_log_info表。如果是MySQL 5.6.5 或者更早期。slave_master_info 和 slave_relay_log_info 表 默认使用MyISAM 引擎。所以还得修改成innodb,如下:
       
    
ALTER TABLE mysql.slave_master_info ENGINE=InnoDB;
     ALTER TABLE mysql.slave_relay_log_info ENGINE=InnoDB;

       如果是MySQL 5.6.6之前,还有一个bug如下:
        a warning is given when this occurs, but the slave is allowed to continue starting. (Bug #13971348) This situation is most likely to occur when upgrading from a version of MySQL that does not support slave logging tables to one in which they are supported.

      所以嘛,用最新的mysql 5.6.20版本,就没有这么多事情。只需做如下几步,就可以享受crash-safe slaves功能

     1.关闭mysql实例
     2.修改my.cnf文件,添加如下内容:
     #*********** MySQL Replication ******************
     master-info-repository=TABLE
     relay-log-info-repository=TABLE
     relay-log-recovery
     3.启动mysql实例

     然后,查看相应的变量和表,就能看到你的成果了。
     show variables like '%relay%';
     show variables like '%master%';
    
     select * from mysql.slave_master_info\G;
     select * from mysql.slave_relay_log_info\G;

     师哥只能帮你到这了,enjoy it!

阅读(446) | 评论(0) | 转发(0) |
0

上一篇:没有了

下一篇:没有了

给主人留下些什么吧!~~