search
HomeDatabaseMysql TutorialMySQL实验室DMB数据库监控及灾备系统 之 [备份模式的选择]

很多企业,特别是中、大型互联网企业都在大量的使用MySQL数据库,并且绝大部分情况下使用的都是InnoDB存储引擎。使用InnoDB存储引擎有很多因素,比如事务安全、自动恢复、行锁、在线备份等等特性。 在MySQL数据库应用和运维中,除了数据库状态和性能监控之外

很多企业,特别是中、大型互联网企业都在大量的使用MySQL数据库,并且绝大部分情况下使用的都是InnoDB存储引擎。使用InnoDB存储引擎有很多因素,比如事务安全、自动恢复、行锁、在线备份等等特性。

在MySQL数据库应用和运维中,除了数据库状态和性能监控之外,数据库的备份一直没有很好的工具去管理,DMB数据库监控及灾备系统就是为解决这一矛盾而诞生的。

DMB系统中备份配置中总共有7种备份模式,下面将针对它们分别介绍,什么样的情况下应该选择什么样的备份模式,以实现最高效的备份,且尽可能的减少对业务的影响。

  • MYSQLDUMP:
    • 调用MySQL系统的mysqldump命令进行备份。其中在只有InnoDB的情况下,可以实现在线热备,不会影响线上业务;在有MyISAM表的情况下,在备份过程当中会增加全局锁,这时候系统是只读的。备份之后会生成 master信息,可以通过备份的SQL文件和master_info.sql 创建slave服务。
  • IBBACKUP_ALL:
    • 备份所有的InnoDB和MyISAM表,在没有MyISAM表的情况下,备份过程中不会对线上业务造成影响,属于在线热备;如果存在MyISAM表,那么在备份完InnoDB之后,备份MyISAM的过程中MySQL数据库是只读的。备份会生成master_info.sql,用于创建slave。
  • IBBACKUP_INNODB:
    • 针对只有InnoDB表的情况,不会备份MyISAM表,属于在线热备,不会造成写堵塞。备份会生成master_info.sql,用于创建slave。
  • IBBACKUP_NONBLOCK:
    • 针对只有InnoDB的情况,不备份MyISAM表,属于在线热备,对系统不造成任何堵塞。备份不生成master_info.sql,不能用该备份创建slave,只用于备份用。
  • XTRABACKUP_ALL: 同 IBBACKUP_ALL
  • XTRABACKUP_INNODB: 同 IBBACKUP_INNODB
  • XTRABACKUP_NONBLOCK: 同 IBBACKUP_NONBLOCK

说明:

  1. 备份模式中以IBBACKUP开头的调用的是 ibbackup,以XTRABACKUP开头的调用的是xtrabackup。
  2. 所有备份都包含MySQL数据库系统库mysql和配置文件my.ini
  3. 在不清楚的情况下备份模式可以选择MYSQLDUMP、IBBACKUP_ALL、XTRABACKUP_ALL 。
  4. IBBACKUP、XTRABACKUP都属于物理备份,恢复速率比MYSQLDUMP要大,能缩短恢复时间。
  5. 其中 IBBACKUP_NONBLOCK、XTRABACKUP_NONBLOCK不会调用flush操作,因此在任何情况下都不会影响在线业务。而其他几种备份模式因为为了取得master info信息,有些会在瞬间加上全局锁然后释放,在极端情况下会对数据库造成一定影响。具体情况以及针对现有MySQL的patch会在后续的blog中加以阐述。

Related posts:

  1. MySQL企业级数据库灾备(备份)系统-DMB v2.1发布
  2. MySQL5.5复制/同步的新特性及改进
  3. MySQL vs NoSQL 效率与成本之争
  4. MySQL 5.5 Released(非GA)
  5. MySQL5.6发布及其新特性

? 谭俊青 发布在 MySQL性能、MySQL Cluster集群、MySQL HA高可用等研究 - MySQL实验室, 2011.
可以任意转载, 但转载时务必以超链接形式标明文章原始出处 和 作者信息。
链接: http://www.mysqlab.net/blog/2011/04/dmb-database-mysql-backup-method/

标签: DMB, ibbackup, xtrabackup, 在线热备, 备份

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Explain the InnoDB Buffer Pool and its importance for performance.Explain the InnoDB Buffer Pool and its importance for performance.Apr 19, 2025 am 12:24 AM

InnoDBBufferPool reduces disk I/O by caching data and indexing pages, improving database performance. Its working principle includes: 1. Data reading: Read data from BufferPool; 2. Data writing: After modifying the data, write to BufferPool and refresh it to disk regularly; 3. Cache management: Use the LRU algorithm to manage cache pages; 4. Reading mechanism: Load adjacent data pages in advance. By sizing the BufferPool and using multiple instances, database performance can be optimized.

MySQL vs. Other Programming Languages: A ComparisonMySQL vs. Other Programming Languages: A ComparisonApr 19, 2025 am 12:22 AM

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages ​​such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages ​​have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

Learning MySQL: A Step-by-Step Guide for New UsersLearning MySQL: A Step-by-Step Guide for New UsersApr 19, 2025 am 12:19 AM

MySQL is worth learning because it is a powerful open source database management system suitable for data storage, management and analysis. 1) MySQL is a relational database that uses SQL to operate data and is suitable for structured data management. 2) The SQL language is the key to interacting with MySQL and supports CRUD operations. 3) The working principle of MySQL includes client/server architecture, storage engine and query optimizer. 4) Basic usage includes creating databases and tables, and advanced usage involves joining tables using JOIN. 5) Common errors include syntax errors and permission issues, and debugging skills include checking syntax and using EXPLAIN commands. 6) Performance optimization involves the use of indexes, optimization of SQL statements and regular maintenance of databases.

MySQL: Essential Skills for Beginners to MasterMySQL: Essential Skills for Beginners to MasterApr 18, 2025 am 12:24 AM

MySQL is suitable for beginners to learn database skills. 1. Install MySQL server and client tools. 2. Understand basic SQL queries, such as SELECT. 3. Master data operations: create tables, insert, update, and delete data. 4. Learn advanced skills: subquery and window functions. 5. Debugging and optimization: Check syntax, use indexes, avoid SELECT*, and use LIMIT.

MySQL: Structured Data and Relational DatabasesMySQL: Structured Data and Relational DatabasesApr 18, 2025 am 12:22 AM

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

MySQL: Key Features and Capabilities ExplainedMySQL: Key Features and Capabilities ExplainedApr 18, 2025 am 12:17 AM

MySQL is an open source relational database management system that is widely used in Web development. Its key features include: 1. Supports multiple storage engines, such as InnoDB and MyISAM, suitable for different scenarios; 2. Provides master-slave replication functions to facilitate load balancing and data backup; 3. Improve query efficiency through query optimization and index use.

The Purpose of SQL: Interacting with MySQL DatabasesThe Purpose of SQL: Interacting with MySQL DatabasesApr 18, 2025 am 12:12 AM

SQL is used to interact with MySQL database to realize data addition, deletion, modification, inspection and database design. 1) SQL performs data operations through SELECT, INSERT, UPDATE, DELETE statements; 2) Use CREATE, ALTER, DROP statements for database design and management; 3) Complex queries and data analysis are implemented through SQL to improve business decision-making efficiency.

MySQL for Beginners: Getting Started with Database ManagementMySQL for Beginners: Getting Started with Database ManagementApr 18, 2025 am 12:10 AM

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment