使用innobakupex备份时,其会调用xtrabackup备份所有的InnoDB表,复制所有关于表结构定义的相关文件(.frm)、以及MyISAM、MERGE、
使用xtrabackup进行备份
Xtrabackup简介
Xtrabackup是由percona提供的mysql数据库备份工具,据官方介绍,这也是世界上惟一一款开源的能够对innodb和xtradb数据库进行热备的工具。特点:
(1)备份过程快速、可靠;
(2)备份过程不会打断正在执行的事务;
(3)能够基于压缩等功能节约磁盘空间和流量;
(4)自动实现备份检验;
(5)还原速度快;
官方介绍和下载地址:https://www.percona.com/software/percona-xtrabackup
xtrabackup安装
官方有系统rpm包版的软件,可以下载rpm包版的软件直接安装,由于xtrabackup是使用perl脚本编写的所以需要安装perl-DBD-MySQL否则会报依赖。
[root@MariaDB~]# yum -y install perl-DBD-MySQL
[root@MariaDB~]# rpm -ivh percona-xtrabackup-2.2.3-4982.el6.x86_64.rpm
innobackupex: 客户端工具, 以mysql协议连入mysqld,不支持离线备份,但是支持离线恢复
--------------------------------------分割线 --------------------------------------
在 CentOS/RHEL/Scientific Linux 6 下安装 LAMP (Apache with MariaDB and PHP)
MariaDB Proxy读写分离的实现
Linux下编译安装配置MariaDB数据库的方法
CentOS系统使用yum安装MariaDB数据库
安装MariaDB与MySQL并存
MySQL管理之使用XtraBackup进行热备
MySQL开源备份工具Xtrabackup备份部署
MySQL Xtrabackup备份和恢复
用XtraBackup实现MySQL的主从复制快速部署【主不锁表】
安装和使用 Percona 推出的 Xtrabackup 备份 MySQL
[翻译]Ubuntu 14.04 (Trusty) Server 安装 MariaDB
--------------------------------------分割线 --------------------------------------
一次完全备份和恢复
1、完全备份
使用innobakupex备份时,其会调用xtrabackup备份所有的InnoDB表,复制所有关于表结构定义的相关文件(.frm)、以及MyISAM、MERGE、CSV和ARCHIVE表的相关文件,同时还会备份触发器和数据库配置信息相关的文件。这些文件会被保存至一个以时间命令的目录中。
在使用innobackupex进行备份时,还可以使用--no-timestamp选项来阻止命令自动创建一个以时间命名的目录;如此一来,innobackupex命令将会创建一个BACKUP-DIR目录来存储备份数据。
示例:
[root@MariaDB~]# innobackupex --user=root --password=centos /backup/
[root@MariaDB~]# ll /backup/
total4
drwxr-xr-x2 root root 4096 Jun 16 02:28 2015-06-16_02-28-54
备份时报了一个错
innobackupex:Error: The xtrabackup child process has died at /usr/bin/innobackupex line2672.
解决方法:修改innodb日志文件大小为5M,修改完成重启服务生效
12 [root@MariaDB~]# vim /etc/my.cnf
innodb_log_file_size= 5M
备份完成之后在/backup目录下就有了如下内容
[root@MariaDB ~]# ll /backup/2015-06-15_23-49-43/
total 18468
-rw-r--r-- 1 root root 356 Jun 15 23:49 backup-my.cnf
drwxr-xr-x 2 root root 4096 Jun 15 23:49 hellodb
-rw-r----- 1 root root 18874368 Jun 15 23:49ibdata1
drwxr-xr-x 2 root root 4096 Jun 15 23:49 mysql
drwxr-xr-x 2 root root 4096 Jun 15 23:49 performance_schema
drwxr-xr-x 2 root root 4096 Jun 15 23:49 test
-rw-r--r-- 1 root root 23 Jun 15 23:49 xtrabackup_binlog_info
-rw-r----- 1 root root 89 Jun 15 23:49 xtrabackup_checkpoints
-rw-r--r-- 1 root root 559 Jun 15 23:49 xtrabackup_info
-rw-r----- 1 root root 2560 Jun 15 23:49 xtrabackup_logfile
文件说明:
(1)xtrabackup_checkpoints—— 备份类型(如完全或增量)、备份状态(如是否已经为prepared状态)和LSN(日志序列号)范围信息;
每个InnoDB页(通常为16k大小)都会包含一个日志序列号,即LSN。LSN是整个数据库系统的系统版本号,每个页面相关的LSN能够表明此页面最近是如何发生改变的。
[root@MariaDB 2015-06-15_23-49-43]# catxtrabackup_checkpoints
backup_type = full-backuped #备份类型,full-backuped表示完全备份
from_lsn = 0 #日志序列开始
to_lsn = 1597945 #最大日志序列号
last_lsn = 1597945 #当前日志序列号
compact = 0 #表示没有打包
(2)xtrabackup_binlog_info —— mysql服务器当前正在使用的二进制日志文件及至备份这一刻为止二进制日志事件的位置。
[root@MariaDB 2015-06-15_23-49-43]# catxtrabackup_binlog_info
mysql-bin.000005 245
(3)backup-my.cnf —— 备份命令用到的配置选项信息和备份无关的不会记录,备份配置文件的话需要单独备份
[root@MariaDB 2015-06-15_23-49-43]# catbackup-my.cnf
# This MySQL options file was generated byinnobackupex.
# The MySQL server
[mysqld]
innodb_checksum_algorithm=innodb
innodb_log_checksum_algorithm=innodb
innodb_data_file_path=ibdata1:10M:autoextend
innodb_log_files_in_group=2
innodb_log_file_size=5242880
innodb_fast_checksum=0
innodb_page_size=16384
innodb_log_block_size=512
innodb_undo_tablespaces=0
(4)xtrabackup_info —— 记录了mariadb的版本信息和一些属性信息,还原是检测版本匹配度时用到
[root@MariaDB 2015-06-15_23-49-43]# catxtrabackup_info
uuid = 25b79086-1376-11e5-980a-000c29bad792
name =
tool_name = innobackupex
tool_command = --user=root --password=... /backup/
tool_version = 1.5.1-xtrabackup
ibbackup_version = xtrabackup version 2.2.3 basedon MySQL server 5.6.17 Linux (x86_64) (revision id: )
server_version = 5.5.43-MariaDB-log
start_time = 2015-06-15 23:49:43
end_time = 2015-06-15 23:49:46
lock_time = 1
binlog_pos = filename 'mysql-bin.000005', position245
innodb_from_lsn = 0
innodb_to_lsn = 1597945
partial = N
incremental = N
format = file
compact = N
compressed = N
encrypted = N

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.

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.

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 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 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 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.

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.

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


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Dreamweaver CS6
Visual web development tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment