`
wutao8818
  • 浏览: 612696 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

moving InnoDB

    博客分类:
  • db
阅读更多
Impossible - possible, moving InnoDB tables between servers
http://www.mysqlperformanceblog.com/2009/06/08/impossible-possible-moving-innodb-tables-between-servers/

Impossible - possible, moving InnoDB tables between servers
Posted by Vadim

This is probably the feature I missed most from early days when I started to use InnoDB instead of MyISAM. Since that I figured out how to survive without it, but this is first question I hear from customers who migrated from MyISAM to InnoDB - can I just copy .ibd files from one server to another and answer “use mysqldump” is quite disappointed.
Jokes aside, I see real needs in this:
- when we need to restore only single table from backup (sometimes developers kill only single table, not whole database )
- to copy single table from production to QA environment. It may sound not so important, but I see needs in this quite often. QA boxes may have their own setup, not so powerful and with not enough space, but QA still needs to have some tables in fresh status.
- resharding databases, moving some shards from one server to another.

So long story short end - we made new mode for XtraBackup, now it can copy and prepare InnoDB/XtraDB tables, which later can be imported into XtraDB.

To be objective the process is still not so easy as with MyISAM tables when you just copy table.frm, table.MYD, table.MYI files, but so nice here - just can copy InnoDB tables in fully non-blocking mode, you do not need to shutdown neither source nor destination server (if destination server runs XtraDB).

In short, process looks like (ah, yes you also need innodb_file_table mode, which ones love, and ones hate)
1) do backup of specific tables on sources server with xtrabackup (server can run InnoDB or XtraDB, it does not matter)
2) do prepare of tables with –export options
3) create table on destination server with exactly the same CREATE TABLE statement as on source. (on destination you should have XtraDB with innodb_expand_import extension and with innodb_expand_import=1 setting)
4) run alter table IMPORTEDTABLE discard tablespace;
5) copy .exp and .ibd files to destination server
6) run alter table IMPORTEDTABLE import tablespace;
7) enjoy progress in error.log like:
InnoDB: import: extended import of test/img_out59
InnoDB: import: 3 indexes are detected.
InnoDB: Progress in %: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 done.

Some more information available on
http://www.percona.com/docs/wiki/percona-xtradb:patch:innodb_expand_import

If you want some internals: I expected the biggest problem with implementation would be merging insert buffer or handling undo records, stored in ibdata file, but it was easy - you just need to shutdown instance with innodb_fast_shutdown=1 (done in xtrabackup –prepare –export call). The more complex problem was that InnoDB stores pointers on root leafs of secondary indexes also in system tablespace. And that’s why we maintain .exp files - to keep information from system tablespace that related to exported table.

Both xtrabackup –export mode and XtraDB innodb_expand_import available only in source code for now, you can get them from Launchpad projects https://launchpad.net/percona-xtradb and https://launchpad.net/percona-xtrabackup. Binary releases will be ready as soon as we have done with testing of this feature. You are welcome to try!
分享到:
评论

相关推荐

    MySQL技术内幕 InnoDB存储引擎.pdf

    最近在学习MySQL技术内幕 InnoDB存储引擎 第2版,整理了一些文档分享出来,同时也方便以后查看。若有不当之处,烦请批评指正。 1. MySQL体系结构和存储引擎 2. InnoDB存储引擎 2.1 InnoDB体系结构 2.2 ...

    MySQL Innodb 索引原理详解

    ### MySQL Innodb 索引原理详解 #### 1. 各种树形结构 在深入探讨MySQL Innodb索引之前,我们先了解几种基本的树形数据结构,包括二叉搜索树、B树、B+树以及B*树。 ##### 1.1 搜索二叉树(Binary Search Tree) ...

    MySQL内核:InnoDB存储引擎 卷1.pdf.zip

    《MySQL内核:InnoDB存储引擎 卷1》是一本深度探讨MySQL数据库系统核心部分——InnoDB存储引擎的专业书籍。这本书以超高清的PDF格式呈现,包含详细的书签,便于读者快速定位和查阅相关内容。InnoDB作为MySQL中最常用...

    py_innodb_page_info工具

    《深入解析py_innodb_page_info:MySQL InnoDB存储引擎底层探索》 在数据库的世界里,MySQL的InnoDB存储引擎以其强大的事务处理能力和行级锁定机制而备受青睐。然而,对于其内部工作原理,许多开发者可能并不十分...

    MySql Innodb 引擎特性详解

    ### MySQL Innodb 引擎特性详解 #### 一、MySQL Innodb 引擎概述 MySQL是一种广泛使用的开源关系型数据库管理系统(RDBMS),它提供了多种存储引擎以满足不同场景的需求。其中,InnoDB是最常用的一种存储引擎之一,...

    innodb_ruby-master.zip

    《MySQL分析:深入理解InnoDB》 MySQL数据库系统在当今数据存储领域占据着重要的地位,尤其在InnoDB存储引擎的支持下,它提供了事务处理、行级锁定以及外键约束等功能,使得MySQL能够满足复杂的业务需求。InnoDB是...

    MySQL Innodb 参数详解与优化实践

    ### MySQL Innodb 参数详解与优化实践 #### 一、引言 MySQL作为一款广泛使用的开源关系型数据库管理系统,其InnoDB存储引擎因其高可靠性和事务处理能力而备受青睐。为了充分发挥InnoDB的优势并针对特定场景进行性能...

    mysql内核 innodb存储引擎

    接着以InnoDB的内部实现为切入点,逐一详细讲解了InnoDB存储引擎内部的各个功能模块,包括InnoDB存储引擎的体系结构、内存中的数据结构、基于InnoDB存储引擎的表和页的物理存储、索引与算法、文件、锁、事务、备份,...

    InnoDB存储引擎中有页(Page)的概念

    InnoDB存储引擎中默认每个页的大小为16KB,可通过参数innodb_page_size将页的大小设置为4K、8K、16K,在MySQL中可通过如下命令查看页的大小: mysql> show variables like 'innodb_page_size'; 而系统一个磁盘块的...

    py_innodb_page_info.zip

    《MySQL技术内幕-InnoDB存储引擎》是一本深入探讨MySQL数据库InnoDB存储引擎的权威书籍,而`py_innodb_page_info.zip`则是该书中提到的一个实用工具,用于分析InnoDB存储引擎的数据页信息。这个Python工具帮助我们...

    InnoDB 中文参考手册

    InnoDB 给 MySQL 提供了具有事务(commit)、回滚(rollback)和崩溃修复能力(crash recovery capabilities)的事务安全(transaction-safe (ACID compliant))型表。InnoDB 提供了行锁(locking on row level),提供与 ...

    MySQL体系结构及原理(innodb)图文完美解析

    ### MySQL体系结构及原理(innodb)图文完美解析 #### 宏观认识 在深入探讨MySQL的体系结构及其核心组件InnoDB之前,我们先来理解几个基础概念。 1. **MySQL简介** MySQL是一种开源的关系型数据库管理系统(RDBMS)...

    MyISAM引擎与InnoDB引擎性能的对比

    MySQL数据库系统提供了多种存储引擎,其中最常用的两种是MyISAM和InnoDB。它们各自具有独特的特性和适用场景,理解二者的性能差异对于优化数据库设计至关重要。 MyISAM引擎是MySQL早期的默认存储引擎,以其高速度和...

    XtraDB、InnoDB 内部结构示意图

    标题《XtraDB、InnoDB 内部结构示意图》表明文章将重点介绍MySQL数据库中XtraDB和InnoDB存储引擎的内部架构。由于内容描述中未给出更详细的信息,我们将基于提供的部分内容来推测文章的核心知识点。 从内容来看,...

    mysql安装innodb插件

    ### MySQL安装InnoDB插件详解 #### 一、前言 在MySQL数据库系统中,InnoDB存储引擎是非常重要的一种类型,它支持事务处理(Transactions)、行级锁定(Row-Level Locking)以及外键约束(Foreign Key Constraints...

    关于InnoDB的索引大小

    在MySQL数据库系统中,InnoDB存储引擎是默认的引擎,它提供了事务处理、行级锁定以及外键支持,使得InnoDB在许多业务场景下成为首选。本篇文章将深入探讨InnoDB存储引擎中的索引大小问题,包括其影响因素、限制以及...

    InnoDB: Hot Backup Manual

    ### InnoDB: 热备份手册 #### 一、ibbackup选项 InnoDB热备份工具(简称ibbackup)是一款能够实现在MySQL运行期间对InnoDB数据库进行无锁备份的强大工具,它不会干扰到正常的数据库处理流程。通过ibbackup,用户...

    MySQL内核:InnoDB存储引擎 卷1.pdf

    《MySQL内核:InnoDB存储引擎 卷1》由资深MySQL专家,机工畅销图书作者亲自执笔,在以往出版的两本InnoDB介绍性图书的基础之上,更深入地介绍InnoDB存储引擎的内核,例如latch、B+树索引、事务、锁等,从源代码的...

Global site tag (gtag.js) - Google Analytics