• xtrabackup: error: last checkpoint LSN (3409281307) is larger than last copied LSN (3409274368)


    1.错误发生场景:使用2.4.1版本的xtrabackup工具进行全备,备份日志中报出此错误
    2.知识要点:
    MySQL中,redo 日志写进程会在三种条件下被触发从log buffer中写日志到redo log file中,分别是每隔一秒、日志达到log buffer的1/3、每一次提交的时候。刷新日志的LSN到log file是采用轮询的方式进行的,比如有三组日志当这三组都被写满的时候再重新覆盖第一组的日志,以此类推。同时checkpoints检查点会刷新在log file被覆盖前刷新buffer [pool中已提交事物对应的脏页到磁盘。
    checkpoints的工作机制:
    http://dev.mysql.com/doc/refman/5.7/en/innodb-checkpoints.html
    回归到备份,xtrabackup会在备份开始的时候就开始复制 redo log file,即复制每一次系统变更的LSN,此错误显然是由于xtrabackup开启的redo log file空间不足所引起的,也就是说当系统中的redo log file被覆盖的时候,xtrabackup还没有将被覆盖前的LSN复制到本地。
    xtrabackup的工作机制:
    https://www.percona.com/doc/percona-xtrabackup/2.4/how_xtrabackup_works.html
    3.错误回顾
    *查看备份集中xtrabackup应用的配置
    [root@host]# cat 2016-07-22_10-36-02/backup-my.cnf

    This MySQL options file was generated by innobackupex.

    The MySQL server

    [mysqld]
    innodb_checksum_algorithm=innodb
    innodb_log_checksum_algorithm=strict_crc32
    innodb_data_file_path=ibdata1:512M:autoextend
    innodb_log_files_in_group=2

    可以看到是innodb_log_files_in_group为2组,但是mysql server配置文件中的[mysqld选项下]指定的是3组,而且是通过选defaults-file选项来指定线上库的配置文件来进行备份的。备份命令:
    innobackupex /data/backup --defaults-file=/etc/mysql/8888.cnf 
    *查看官方文档,上面明文规定要将--defaults-file选项放到第一位,再次尝试备份,备份命令:
    innobackupex --defaults-file=/etc/mysql/8888.cnf /data/backup
    [root@host]# cat 2016-07-22_10-36-30/backup-my.cnf

    This MySQL options file was generated by innobackupex.

    The MySQL server

    [mysqld]
    innodb_checksum_algorithm=innodb
    innodb_log_checksum_algorithm=strict_crc32
    innodb_data_file_path=ibdata1:512M:autoextend
    innodb_log_files_in_group=3

    开始识别配置文件
    到目前为止可以判定是参数位置放置不当引起的。
    4.测试总结
    [root@test]# innobackupex --version
    innobackupex version 2.4.3 Linux (x86_64) (revision id: 6a46905)
    [root@test]# innobackupex /data/backup --defaults-file=/etc/mysql/3306.cnf 
    xtrabackup: Error: unknown argument: '/data0/backup'

    2.4.3版本中,如果--defaults-file没有放在第一个位置则会报错,而2.4.1中如果放不对位置则没有错误提示,但是也不识别制定的配置文件,依然使用默认配置。

  • 相关阅读:
    java 新特性学习笔记
    Can't zip RDDs with unequal numbers of partitions
    编写自己的代码库(javascript常用实例的实现与封装)
    Python高级笔记(一) -- GIL (全局解释器锁)
    CMake快速入门
    Cmake出现CMake Error: Could not find CMAKE_ROOT !!!
    Python复习笔记(十一)TCP/IP协议
    用vim打开.py和.sh文件自动添加头
    如何实现Python调用C代码--python与C之间如何通信(swig)
    dpkg用管道批量删除deb
  • 原文地址:https://www.cnblogs.com/Bccd/p/5856710.html
Copyright © 2020-2023  润新知