mysql备份工具之Xtrabackup
Xtrabackup是一个对InnoDB存储引擎做数据备份的工具,支持在线热备份(备份时不影响数据读写),是商业备份工具InnoDBHotbackup的一个很好的替代品.Xtrabackup有两个
Xtrabackup是一个对InnoDB存储引擎做数据备份的工具,支持在线热备份(备份时不影响数据读写),是商业备份工具InnoDB Hotbackup的一个很好的替代品.Xtrabackup有两个主要工具:xtrabackup,innobackupex,且只能备份InnoDB和XtraDB两种存储引擎的表,而不能备份MyISAM数据表
1.下载安装xtrabackup工具
[root@tong2 ~]# wget
[root@tong2 ~]# tar xvf Percona-XtraBackup-2.2.7-r5050-el6-x86_64-bundle.tar
[root@tong2 ~]# ll percona-xtrabackup-*
-rw-rw-r--. 1 root root 4863276 Dec 4 22:18 percona-xtrabackup-2.2.7-5050.el6.x86_64.rpm
-rw-rw-r--. 1 root root 648012 Dec 4 22:18 percona-xtrabackup-debuginfo-2.2.7-5050.el6.x86_64.rpm
-rw-rw-r--. 1 root root 961432 Dec 4 22:18 percona-xtrabackup-test-2.2.7-5050.el6.x86_64.rpm[root@tong2 ~]# yum localinstall percona-xtrabackup-* -y
[root@tong2 ~]# rpm -ql percona-xtrabackup-2.2.7-5050.el6.x86_64
/usr/bin/innobackupex
/usr/bin/xbcrypt
/usr/bin/xbstream
/usr/bin/xtrabackup
/usr/share/doc/percona-xtrabackup-2.2.7
/usr/share/doc/percona-xtrabackup-2.2.7/COPYING
[root@tong2 ~]#
2.创建数据库和innodb表
[root@tong2 ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 16
Server version: 5.6.21-log MySQL Community Server (GPL)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> \u tong
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> create table t (a int) engine=innodb;
Query OK, 0 rows affected (0.27 sec)
mysql> insert into t values(1),(2),(3),(4),(5);
Query OK, 5 rows affected (0.03 sec)
Records: 5 Duplicates: 0 Warnings: 0
mysql> select * from t;
+------+
| a |
+------+
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |
+------+
5 rows in set (0.00 sec)
mysql> exit
Bye
[root@tong2 ~]#
3.完整备份innodb存储引擎的表
[root@tong2 ~]# innobackupex --help |more --查看帮助信息
[root@tong2 ~]# innobackupex --user=root --password=system /opt/tong 2> /opt/tong/backup.log
[root@tong2 ~]# ll /opt/tong/2015-01-04_16-00-37/
total 12324
-rw-r--r--. 1 root root 295 Jan 4 16:00 backup-my.cnf
-rw-r-----. 1 root root 12582912 Jan 4 16:00 ibdata1
drwx------. 2 root root 4096 Jan 4 16:00 mysql
drwxr-xr-x. 2 root root 4096 Jan 4 16:00 performance_schema
drwxr-xr-x. 2 root root 4096 Jan 4 16:00 test
drwx------. 2 root root 4096 Jan 4 16:00 tong
-rw-r--r--. 1 root root 22 Jan 4 16:00 xtrabackup_binlog_info --二进制日志信息
-rw-r-----. 1 root root 89 Jan 4 16:00 xtrabackup_checkpoints --备份数据的检查点
-rw-r--r--. 1 root root 553 Jan 4 16:00 xtrabackup_info --备份信息
-rw-r-----. 1 root root 2560 Jan 4 16:00 xtrabackup_logfile --日志文件
[root@tong2 ~]# innobackupex --user=root --password=system --databases=tong /opt/tong --备份指定的数据库2> /opt/tong/backup.log
[root@tong2 ~]# ll /opt/tong/2015-01-04_16-02-36/
total 12312
-rw-r--r--. 1 root root 295 Jan 4 16:02 backup-my.cnf
-rw-r-----. 1 root root 12582912 Jan 4 16:02 ibdata1
drwx------. 2 root root 4096 Jan 4 16:02 tong
-rw-r--r--. 1 root root 22 Jan 4 16:02 xtrabackup_binlog_info
-rw-r-----. 1 root root 89 Jan 4 16:02 xtrabackup_checkpoints
-rw-r--r--. 1 root root 570 Jan 4 16:02 xtrabackup_info
-rw-r-----. 1 root root 2560 Jan 4 16:02 xtrabackup_logfile
[root@tong2 ~]#
4.在完整备份中添加增量备份
[root@tong2 ~]# innobackupex --user=root --password=system --incremental --incremental-basedir=/opt/tong/2015-01-04_17-34-25/ /opt/tong
--incremental --增量备份
--incremental-basedir --完整备份文件的路径
/opt/tong --增量备份文件存放处
5.全备份时压缩以节省资源

핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

드림위버 CS6
시각적 웹 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

뜨거운 주제











이 기사는 MySQL의 Alter Table 문을 사용하여 열 추가/드롭 테이블/열 변경 및 열 데이터 유형 변경을 포함하여 테이블을 수정하는 것에 대해 설명합니다.

기사는 인증서 생성 및 확인을 포함하여 MySQL에 대한 SSL/TLS 암호화 구성에 대해 설명합니다. 주요 문제는 자체 서명 인증서의 보안 영향을 사용하는 것입니다. [문자 수 : 159]

기사는 MySQL에서 파티셔닝, 샤딩, 인덱싱 및 쿼리 최적화를 포함하여 대규모 데이터 세트를 처리하기위한 전략에 대해 설명합니다.

기사는 MySQL Workbench 및 Phpmyadmin과 같은 인기있는 MySQL GUI 도구에 대해 논의하여 초보자 및 고급 사용자를위한 기능과 적합성을 비교합니다. [159 자].

이 기사에서는 Drop Table 문을 사용하여 MySQL에서 테이블을 떨어 뜨리는 것에 대해 설명하여 예방 조치와 위험을 강조합니다. 백업 없이는 행동이 돌이킬 수 없으며 복구 방법 및 잠재적 생산 환경 위험을 상세하게합니다.

이 기사에서는 PostgreSQL, MySQL 및 MongoDB와 같은 다양한 데이터베이스에서 JSON 열에서 인덱스를 작성하여 쿼리 성능을 향상시킵니다. 특정 JSON 경로를 인덱싱하는 구문 및 이점을 설명하고 지원되는 데이터베이스 시스템을 나열합니다.

기사는 외국 열쇠를 사용하여 데이터베이스의 관계를 나타내고 모범 사례, 데이터 무결성 및 피할 수있는 일반적인 함정에 중점을 둡니다.

기사는 준비된 명령문, 입력 검증 및 강력한 암호 정책을 사용하여 SQL 주입 및 무차별 적 공격에 대한 MySQL 보안에 대해 논의합니다 (159 자)
