zoukankan      html  css  js  c++  java
  • 复制故障处理

    slave复制中,常见的错误有:

    1032:Can't find record in %s
    1053:Server shutdown in process
    1062:Duplicate entry %s for key %d
    1050:Table %s already exists
    1051:Unknown table %s
    1054:Unknown column %s in %s
    1146:Table %s.%s doesn't exists
    1236:Fatal error reading binlog
     

    1032,1062,1236错误处理

    记录不存在:1032(主库更新或删除的记录在从库上不存在)
    看在master上执行了什么
    mysqlbinlog --base64-output=decode-rows -vv --start-position='1009144978' --stop-position='1010617671' mysql-bin.000045
    将相应的记录在从库上执行
    记录不存在:1032(delete情况)
    跳过一个事务
    传统环境复制:
    stop slave;
    set global sql_slave_skip_counter = 1;
    start slave;
    GTID环境复制:
    stop slave;
    set gtid_next='766d5362-c923-11e6-85b5-000c29de38de:12';   已执行的加1
    begin;commit;
    set gtid_next='AUTOMATIC';
    start slave;
    主键冲突:1062错误
    在从库上将相应主键的记录删掉
    1236错误:log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master;
    show VARIABLES like '%max_allowed_packet%';
    set global max_allowed_packet =512*1024*1024;
     

    MySQL5.6针对复制功能提供了新特性:slave支持crash-safe

    1.停止slave的MySQL实例
    2.my.cnf文件中添加
       master-info-repository=TABLE
       relay-log-info-repository=TABLE
       relay-log-recovery
    3.重启slave的MySQL实例
     
  • 相关阅读:
    VS快捷键
    eclipse快捷键(shift+ctrl+l能出来所有的快捷键)
    永远不要觉得自己代码有多6
    winform中使用webBrowser时如何与JS交互
    HTML CSS
    HTTP 协议 session cookie
    [Python3]Python官方文档-Python Manuals
    [python3]PyCharm编辑器
    Loadrunner上传文件与下载文件脚本
    Spotlight安装
  • 原文地址:https://www.cnblogs.com/allenhu320/p/11316305.html
Copyright © 2011-2022 走看看