V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Dreamerwwr
V2EX  ›  程序员

数据库迁移,恢复热备数据,为什么恢复不了?

  •  
  •   Dreamerwwr · 2021-02-05 18:43:34 +08:00 · 1587 次点击
    这是一个创建于 1394 天前的主题,其中的信息可能已经有所发展或是发生改变。

    环境说明: mysql:5.7 innobackupex: 2.4.21

    热备数据(从低版本的 mysql 备份出来的): mysql:5.6.16, 从下面看出来的

    [root@crm-db logfile_bak]# cat xtrabackup_info
    uuid = 24a45c55-9d0c-11e9-999e-7cd30aeb1510
    name =
    tool_name = innobackupex
    tool_command = --defaults-file=/etc/my3133.cnf --password=... --user=root --host=127.0.0.1 --port=3133 --tmpdir=/home/mysql/backup/3133 --rocksdb_checkpoint_path=/mysqldata/backup_tmp/15526073_6461023 --rds-xb-fd-limits=400000 --slave-info --stream=xbstream --compress --rds-table-level /home/mysql/backup/3133
    tool_version = 2.3.10
    ibbackup_version = 2.3.10
    server_version = 5.6.16-log
    start_time = 2019-07-02 23:39:56
    end_time = 2019-07-03 04:58:29
    lock_time = 1
    binlog_pos = filename 'mysql-bin.000813', position 326799, GTID of the last change '5a2ce42e-9b9e-11e9-999e-98039b075e04:1-1954113'
    innodb_from_lsn = 0
    innodb_to_lsn = 1064285712580
    partial = N
    incremental = N
    format = xbstream
    compact = N
    compressed = compressed
    encrypted = N
    [root@crm-db logfile_bak]# innobackupex -v
    xtrabackup: recognized server arguments: --datadir=/data/data --log_bin=mysql-bin --server-id=2 --log_bin=/data/data_log/log_bin/mysql-bin.log
    innobackupex version 2.4.21 Linux (x86_64) (revision id: 5988af5)
    

    这里我严格按照阿里云的规范步骤来进行解包、解压、还原。前两步都正常,还原却卡住了,一直过不去。报错如下:

    [root@crm-db data]# innobackupex --defaults-file=/data/data/backup-my.cnf --apply-log /data/data
    xtrabackup: recognized server arguments: --innodb_checksum_algorithm=innodb --innodb_log_checksum_algorithm=innodb --innodb_data_file_path=ibdata1:200M:autoextend --innodb_log_files_in_group=2 --innodb_log_file_size=1572864000 --innodb_fast_checksum=0 --innodb_page_size=16384 --innodb_log_block_size=512 --innodb_undo_directory=. --innodb_undo_tablespaces=0 
    xtrabackup: recognized client arguments: 
    210205 16:44:50 innobackupex: Starting the apply-log operation
    
    IMPORTANT: Please check that the apply-log run completes successfully.
               At the end of a successful apply-log run innobackupex
               prints "completed OK!".
    
    innobackupex version 2.4.21 based on MySQL server 5.7.32 Linux (x86_64) (revision id: 5988af5)
    xtrabackup: cd to /data/data/
    xtrabackup: This target seems to be not prepared yet.
    InnoDB: Number of pools: 1
    xtrabackup: xtrabackup_logfile detected: size=9437184, start_lsn=(1064284351341)
    xtrabackup: using the following InnoDB configuration for recovery:
    xtrabackup:   innodb_data_home_dir = .
    xtrabackup:   innodb_data_file_path = ibdata1:200M:autoextend
    xtrabackup:   innodb_log_group_home_dir = .
    xtrabackup:   innodb_log_files_in_group = 1
    xtrabackup:   innodb_log_file_size = 9437184
    xtrabackup: using the following InnoDB configuration for recovery:
    xtrabackup:   innodb_data_home_dir = .
    xtrabackup:   innodb_data_file_path = ibdata1:200M:autoextend
    xtrabackup:   innodb_log_group_home_dir = .
    xtrabackup:   innodb_log_files_in_group = 1
    xtrabackup:   innodb_log_file_size = 9437184
    xtrabackup: Starting InnoDB instance for recovery.
    xtrabackup: Using 104857600 bytes for buffer pool (set by --use-memory parameter)
    InnoDB: PUNCH HOLE support available
    InnoDB: Mutexes and rw_locks use GCC atomic builtins
    InnoDB: Uses event mutexes
    InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
    InnoDB: Compressed tables use zlib 1.2.7
    InnoDB: Number of pools: 1
    InnoDB: Not using CPU crc32 instructions
    InnoDB: Initializing buffer pool, total size = 100M, instances = 1, chunk size = 100M
    InnoDB: Completed initialization of buffer pool
    InnoDB: page_cleaner coordinator priority: -20
    InnoDB: Highest supported file format is Barracuda.
    InnoDB: Attempted to open a previously opened tablespace. Previous tablespace mysql/plugin at filepath: ./mysql/plugin.ibd uses space ID: 2. Cannot open filepath: ./mysql/innodb_index_stats.ibd which uses the same space ID.
    

    我检查了 /data/data/mysql 下,看到是有 innodb_index_stats.ibd 文件的,这里我实在不知道该如何操作了,有没有热心的网友指导一下,给个思路。

    4 条回复    2021-02-09 20:59:12 +08:00
    Dreamerwwr
        1
    Dreamerwwr  
    OP
       2021-02-05 18:46:01 +08:00
    补充一下阿里云的操作文档地址: https://help.aliyun.com/knowledge_detail/41817.html?spm=a2c4g.11186623.6.766.6463323fy2zgeo#title-w9g-2cs-3fh
    我是按照这个操作来的,压缩文件是:_qp.xb 后缀.
    麻烦热心的各位指导一下,不胜感激。
    bjt
        2
    bjt  
       2021-02-05 18:54:03 +08:00
    看看文件能否正常读取,文件的所属用户、权限是否正确
    Dreamerwwr
        3
    Dreamerwwr  
    OP
       2021-02-05 19:13:24 +08:00
    @bjt 权限都是正确的
    pc10201
        4
    pc10201  
       2021-02-09 20:59:12 +08:00
    用阿里云 DTS 迁移啊
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1586 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 17:02 · PVG 01:02 · LAX 09:02 · JFK 12:02
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.