MySQL Percona XtraBackup
Red Hat Enterprise Linux Server release 6.6 (Santiago)
[root@mysqlgc opt]# tar -xvf Percona-XtraBackup-2.4.6-r8ec05b7-el6-x86_64-bundle.tar
percona-xtrabackup-24-2.4.6-2.el6.x86_64.rpm
percona-xtrabackup-24-debuginfo-2.4.6-2.el6.x86_64.rpm
percona-xtrabackup-test-24-2.4.6-2.el6.x86_64.rpm
[root@mysqlgc opt]# yum localinstall percona-xtrabackup-*
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Local Package Process
Examining percona-xtrabackup-test-24-2.4.6-2.el6.x86_64.rpm: percona-xtrabackup-test-24-2.4.6-2.el6.x86_64
Marking percona-xtrabackup-test-24-2.4.6-2.el6.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package percona-xtrabackup-test-24.x86_64 0:2.4.6-2.el6 will be installed
--> Processing Dependency: percona-xtrabackup-24 = 2.4.6-2.el6 for package: percona-xtrabackup-test-24-2.4.6-2.el6.x86_64
--> Finished Dependency Resolution
Error: Package: percona-xtrabackup-test-24-2.4.6-2.el6.x86_64 (/percona-xtrabackup-test-24-2.4.6-2.el6.x86_64)
Requires: percona-xtrabackup-24 = 2.4.6-2.el6
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
下載libev-4.15-1.el6.rf.x86_64.rpm安裝後再安裝xtrabackup OK
http://www.cnblogs.com/kerrycode/p/5308719.html
[root@mysqlgc opt]# rpm -ivh libev-4.15-1.el6.rf.x86_64.rpm
[root@mysqlgc opt]# yum localinstall percona-xtrabackup-*
[root@mysqlgc bak]# innobackupex --socket=/data/mysql/mysql.sock -u root -p Oracle123$ /data/bak/ --no-timestamp
170317 13:39:10 innobackupex: Starting the backup operation
IMPORTANT: Please check that the backup run completes successfully.
At the end of a successful backup run innobackupex
prints "completed OK!".
170317 13:39:11 version_check Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup;mysql_socket=/data/mysql/mysql.sock' as 'root' (using password: YES).
170317 13:39:11 version_check Connected to MySQL server
170317 13:39:11 version_check Executing a version check against the server...
170317 13:39:11 version_check Done.
170317 13:39:11 Connecting to MySQL server host: localhost, user: root, password: set, port: not set, socket: /data/mysql/mysql.sock
Using server version 5.7.16-log
innobackupex version 2.4.6 based on MySQL server 5.7.13 Linux (x86_64) (revision id: 8ec05b7)
xtrabackup: uses posix_fadvise().
xtrabackup: cd to /data/mysql
xtrabackup: open files limit requested 0, set to 1024
xtrabackup: using the following InnoDB configuration:
xtrabackup: innodb_data_home_dir = .
xtrabackup: innodb_data_file_path = ibdata1:12M:autoextend
xtrabackup: innodb_log_group_home_dir = ./
xtrabackup: innodb_log_files_in_group = 2
xtrabackup: innodb_log_file_size = 50331648
InnoDB: Number of pools: 1
170317 13:39:11 >> log scanned up to (44924089203)
xtrabackup: Generating a list of tablespaces
InnoDB: Allocated tablespace ID 4 for mysql/help_topic, old maximum was 0
170317 13:39:11 [01] Copying ./ibdata1 to /data/bak/ibdata1
170317 13:39:12 >> log scanned up to (44924089203)
170317 13:39:13 >> log scanned up to (44924089203)
170317 13:39:14 >> log scanned up to (44924089203)
170317 13:39:14 [01] ...done
170317 13:39:14 [01] Copying ./mysql/help_topic.ibd to /data/bak/mysql/help_topic.ibd
170317 13:39:14 [01] ...done
170317 13:39:14 [01] Copying ./mysql/plugin.ibd to /data/bak/mysql/plugin.ibd
170317 13:39:14 [01] ...done
170317 13:39:14 [01] Copying ./mysql/slave_relay_log_info.ibd to /data/bak/mysql/slave_relay_log_info.ibd
170317 13:39:14 [01] ...done
170317 13:39:14 [01] Copying ./mysql/help_keyword.ibd to /data/bak/mysql/help_keyword.ibd
170317 13:39:14 [01] ...done
170317 13:39:14 [01] Copying ./mysql/slave_worker_info.ibd to /data/bak/mysql/slave_worker_info.ibd
170317 13:39:14 [01] ...done
170317 13:39:14 [01] Copying ./mysql/slave_master_info.ibd to /data/bak/mysql/slave_master_info.ibd
170317 13:39:14 [01] ...done
170317 13:39:14 [01] Copying ./mysql/server_cost.ibd to /data/bak/mysql/server_cost.ibd
170317 13:39:14 [01] ...done
170317 13:39:14 [01] Copying ./mysql/time_zone_transition.ibd to /data/bak/mysql/time_zone_transition.ibd
170317 13:39:14 [01] ...done
170317 13:39:14 [01] Copying ./mysql/servers.ibd to /data/bak/mysql/servers.ibd
170317 13:39:14 [01] ...done
170317 13:40:37 Finished backing up non-InnoDB tables and files
170317 13:40:37 [00] Writing xtrabackup_binlog_info
170317 13:40:37 [00] ...done
170317 13:40:37 Executing FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS...
xtrabackup: The latest check point (for incremental): '44924089194'
xtrabackup: Stopping log copying thread.
.170317 13:40:37 >> log scanned up to (44924089203)
170317 13:40:37 Executing UNLOCK TABLES
170317 13:40:37 All tables unlocked
170317 13:40:37 [00] Copying ib_buffer_pool to /data/bak/ib_buffer_pool
170317 13:40:37 [00] ...done
170317 13:40:37 Backup created in directory '/data/bak/'
MySQL binlog position: filename 'mysql-bin.000016', position '452'
170317 13:40:37 [00] Writing backup-my.cnf
170317 13:40:37 [00] ...done
170317 13:40:37 [00] Writing xtrabackup_info
170317 13:40:37 [00] ...done
xtrabackup: Transaction log of lsn (44924089194) to (44924089203) was copied.
170317 13:40:38 completed OK!
增量備份
[root@vSWHVMSDBTE01 bak]# innobackupex --socket=/var/lib/mysql/mysql.sock -u root -p Oracle123$ /data/bak/ --no-timestamp
[root@vSWHVMSDBTE01 bak]# innobackupex --socket=/var/lib/mysql/mysql.sock -u root -p Oracle123$ --incremental /data/bak_incr/ --incremental-basedir=/data/bak --no-timestamp
增量恢復
[root@vSWHVMSDBTE01 lib]# service mysqld stop
[root@vSWHVMSDBTE01 lib]# mv /var/lib/mysql /var/lib/mysql_old
[root@vSWHVMSDBTE01 lib]# mkdir /var/lib/mysql
[root@vSWHVMSDBTE01 lib]# chown -R mysql.mysql mysql
恢復全備份Read only模式
[root@vSWHVMSDBTE01 bak]# innobackupex --apply-log --redo-only /data/bak
最次一次增量恢復不需要read only
[root@vSWHVMSDBTE01 bak_incr]# innobackupex --apply-log /data/bak --incremental-dir=/data/bak_incr
恢復全備份,回滾未提交事務
[root@vSWHVMSDBTE01 bak_incr]# innobackupex --apply-log /data/bak
[root@vSWHVMSDBTE01 mysql]# innobackupex --copy-back /data/bak
[root@vSWHVMSDBTE01 mysql]# chown -R mysql.mysql /var/lib/mysql
[root@vSWHVMSDBTE01 mysql]# service mysqld start
案例
Mysql 5.6 還原至Mysql 5.7
備份
0 3 * * * root /backup/mysql/mysql-full-backup.sh 1>>/backup/mysql/mysql_full_backup.log 2>>/backup/mysql/mysql_full_backup.bad
#!/bin/bash
#export MYSQL_HOME=/usr/local/Percona-Server-5.5.21-rel25.0-227.Linux.x86_64/
#export PATH=$MYSQL_HOME/bin:$PATH
mysql_backup_dir=/backup/mysql/
mysql_username="root"
mysql_password="root"
cd $mysql_backup_dir
timeStart=$(date '+%Y%m%d%H%M%S')
backupfile=full-$timeStart.tar.gz
logfile=full-$timeStart.log
innobackupex --defaults-file=/etc/my.cnf --stream=tar /tmp
--user=$mysql_username --password=$mysql_password | gzip ->
"$backupfile"
tar -xizf full-20170315220514.tar.gz
Warning
To extract Percona XtraBackup‘s archive you must use tar with -i option:
$ tar -xizf backup.tar.gz
恢復
#tar -zvfx full-20170315220514.tar.gz
#innobackupex
--apply-log /data/bak_test/
#innobackupex
--copy-back /data/bak_test
#chown -R mysql.mysql mysql
#vi /etc/my.cnf 無密碼登入
[mysqld]
skip-grant-tables
#service mysqld start
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25583515/viewspace-2146468/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 基於percona xtrabackup 2.4.14的增量備份恢復還原mysql 5.6MySql
- 如何根據生產環境mysql版本選擇合適的percona xtrabackup版本MySql
- Percona Xtrabackup2.4.12版本安裝小記
- CentOS下使用yum方式安裝percona xtrabackup步驟CentOS
- MySQL:xtrabackup備份MySql
- MySQL8.0之XtraBackupMySql
- MySQL xtrabackup for centos7.2安裝MySqlCentOS
- mysql之 xtrabackup-2.4.12 安裝MySql
- 使用Xtrabackup遠端備份MysqlMySql
- mysql,mariaDB,Percona Server,MongoDB,Redis,RocksDBMySqlServerMongoDBRedis
- 基於percona xtrabackup之innobackupex實現基於時間點資料庫恢復資料庫
- MariaDB 10.3版本開始無法使用Percona XtraBackup來進行備份了
- xtrabackup備份mysql“ib_logfile0 is ofMySql
- Percona xtrabackup2.4版本遠端備份和搭建從庫的方法介紹
- 【MySQL】Xtrabackup備份及恢復指令碼MySql指令碼
- 【MySQL】xtrabackup 2.4.12備份觸發的bugMySql
- MySQL Backup--Xtrabackup備份限速問題MySql
- MySQL 複製全解析 Part 11 使用xtrabackup建立MySQL複製MySql
- Ubuntu16.04 percona MySQL客戶端安裝UbuntuMySql客戶端
- 【Xtrabackup】Xtrabackup備份基礎知識
- mysql之 Percona XtraDB Cluster叢集執行緒模型MySql執行緒模型
- Percona-Tookit工具包之pt-mysql-summaryMySql
- MySQL基礎運維——percona-toolkit運維工具MySql運維
- XtraBackup工具詳解 Part 2 xtrabackup安裝
- XtraBackup工具詳解 Part 3 XtraBackup工作原理
- xtrabackup備份mysql以及建立自動定時任務MySql
- 使用percona-toolkit操作MySQL的實用命令小結MySql
- 【Xtrabackup】Xtrabackup全備、增量備份及恢復示例
- mysql運維利器percona-toolkit工具之pt-query-digestMySql運維
- MySQL高可用方案-PXC(Percona XtraDB Cluster)環境部署詳解MySql
- Percona Toolkit工具連線MySQL 8報錯的解決方案MySql
- MySQL備份與恢復——基於Xtrabackup物理備份恢復MySql
- 記一次mysql熱備份xtrabackup(沒有解決問題)MySql
- XtraBackup工具詳解 Part 4 XtraBackup許可權及配置
- RHEL安裝Xtrabackup
- Xtrabackup增量備份
- XtraBackup不停機不鎖表做MySQL主從複製的試驗MySql
- MySQL挑戰:100k連線 - Percona資料庫效能部落格MySql資料庫
- Xtrabackup 2.4.14使用指南