Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1950844
  • 博文数量: 176
  • 博客积分: 1857
  • 博客等级: 上尉
  • 技术积分: 2729
  • 用 户 组: 普通用户
  • 注册时间: 2012-04-14 22:55
个人简介

吾生有涯,而知无涯,适当止学.循序渐进,步步提升 Talk is cheap, show me the code.

文章分类

全部博文(176)

文章存档

2019年(1)

2018年(14)

2017年(20)

2016年(31)

2015年(15)

2014年(5)

2013年(10)

2012年(80)

分类: Mysql/postgreSQL

2014-09-16 11:21:05

     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!

阅读(2808) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~