一个合格的运维工程师或者dba工程师,如果有从事数据库方面的话,首先需要做的就是备份,如果没有备份,出现问题的话,你的业务就会出问题,你的工作甚至会。。。

所以备份是重要的,但光有备份还不行,备份后如果出现问题,你还得使用备份数据来恢复,但恢复数据的时间一般都是很长的,不符合业务需求,所以一个快速备份与恢复的软件就很有必要。

之前我在维护mysql数据库的时候,使用mysqldump来进行备份与恢复,在备份的时候锁住表,然后全部备份,在数据少的时候没问题,但如果数据很多,不允许锁表,同时需要恢复数据块的情况,mysqldump就不适合了,我在恢复一个4G数据文件的数据库的时候,恢复的数据是使用mysqldump的数据,恢复了3个小时还没有反应,造成的影响很严重,所以我开始寻找其他的别发软件来满足以上的需求,幸好找到了,就是使用xtrabackup来进行备份与恢复,恢复4G数据文件的数据库,仅需要14秒,同时在备份的时候不会锁表,而且支持增量备份,所以把我的比较分享给大家,希望对大家有益!

Xtrabackup 是percona公司的开源项目,用以实现类似innodb官方的热备份工具InnoDB Hot Backup的功能,能够非常快速地备份与恢复mysql数据库。 Xtrabackup中包含两个工具:

xtrabackup是用于热备份innodb, xtradb表中数据的工具,不能备份其他类型的表,也不能备份数据表结构;

innobackupex是将xtrabackup进行封装的perl脚本,提供了备份myisam表的能力。

由于innobackupex的功能更为全面和完善,所以,本文以innobackupex作为基础进行研究描述。

下面介绍xtrabackup的全部、增量的备份与恢复。

一、下载与安装
1、下载
  1. wget http://www.percona.com/redir/downloads/XtraBackup/XtraBackup-1.6.7/binary/Linux/x86_64/xtrabackup-1.6.7.tar.gz
2、安装依赖库
如果是debian系列的话
  1. apt-get install debhelper autotools-dev libaio-dev wget automake   libtool bison libncurses-dev libz-dev cmake bzr
如果是redhat系列的话
  1. yum install cmake gcc gcc-c++ libaio libaio-devel automake autoconf bzr   bison libtool ncurses-devel zlib-devel
3、解压
  1. tar zxvf xtrabackup-1.6.7.tar.gz
4、进入目录
  1. cd xtrabackup-1.6.7

5、复制

  1. cd bin
  2. cp * /usr/bin
  3. 然后就安装完成了,下面开始备份

其中,

innobackupex是我们要使用的备份工具;

xtrabackup是被封装在innobackupex之中的,innobackupex运行时需要调用它;

xtrabackup_51是xtrabackup运行时需要调用的工具;

tar4ibd是以tar流的形式产生备份时用来打包的工具。

6、对某个数据库进行全部备份的命令介绍
  1. innobackupex --user=root --password=123456 --defaults-file=/etc/mysql/my.cnf --database=test --stream=tar /tmp/data/ 2>/tmp/data/err.log|gzip 1>/tmp/data/test.tar.gz
说明:
      --database=test 单独对test数据库做备份 ,若是不添加此参数那就那就是对全库做备份
      2>/tmp/data/err.log 输出信息写入日志中
      1>/tmp/data/test.tar.gz 打包压缩存储到该文件中
二、对数据库的全部备份与恢复
下面开始测试xtrabackup的全部备份
(1)先进入mysql里创建一个新的test数据库
  1. root@client2:/tmp# mysql -u root -p
  2. Enter password:
  3. Welcome to the MySQL monitor.  Commands end with ; or \g.
  4. Your MySQL connection id is 40
  5. Server version: 5.5.28-0ubuntu0.12.04.3-log (Ubuntu)
  6. Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
  7. Oracle is a registered trademark of Oracle Corporation and/or its
  8. affiliates. Other names may be trademarks of their respective
  9. owners.
  10. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  11. mysql> drop database test;
  12. Query OK, 3 rows affected (0.13 sec)
  13. mysql> create database test;
  14. Query OK, 1 row affected (0.00 sec)
  15. mysql> use test;
  16. Database changed
  17. mysql> create table test (id int);
  18. Query OK, 0 rows affected (0.06 sec)
  19. mysql> insert into test values(1);
  20. Query OK, 1 row affected (0.04 sec)
  21. mysql> insert into test values(2);
  22. Query OK, 1 row affected (0.01 sec)
  23. mysql> insert into test values(3);
  24. Query OK, 1 row affected (0.00 sec)
  25. mysql> insert into test values(4);
  26. Query OK, 1 row affected (0.00 sec)
  27. mysql> insert into test values(5);
  28. Query OK, 1 row affected (0.01 sec)
  29. mysql> select * from test;
  30. +------+
  31. | id   |
  32. +------+
  33. |    1 |
  34. |    2 |
  35. |    3 |
  36. |    4 |
  37. |    5 |
  38. +------+
  39. 5 rows in set (0.00 sec)
  40. mysql> flush privileges;
  41. Query OK, 0 rows affected (0.00 sec)
(2)然后备份test的整个数据库
使用下面的backup.sh脚本
  1. root@client2:/tmp# cat backup.sh
  2. #!/bin/bash
  3. user='root'
  4. passwd='123456'
  5. database=test
  6. my_config='/etc/mysql/my.cnf'
  7. log=$database-$(date +%Y%m%d%H%M).log
  8. str=$database-$(date +%Y%m%d%H%M).tar.gz
  9. backup_dir='/tmp/data'
  10. echo "Start to backup at $(date +%Y%m%d%H%M)"
  11. if [ ! -d "$backup_dir" ];then
  12. mkdir $backup_dir
  13. fi
  14. innobackupex --user=$user --password=$passwd --defaults-file=$my_config --database=$database --stream=tar $backup_dir 2>$backup_dir/$log | gzip 1>$backup_dir/$str
  15. if [ $? -eq 0 ];then
  16. echo "Backup is finish! at $(date +%Y%m%d%H%M)"
  17. exit 0
  18. else
  19. echo "Backup is Fail! at $(date +%Y%m%d%H%M)"
  20. exit 1
  21. fi
现在开始运行此脚本
  1. root@client2:/tmp# sh backup.sh
  2. Start to backup at 201303072101
  3. Backup is finish! at 201303072102
然后到data里查看结果
  1. root@client2:/tmp# cd data
  2. root@client2:/tmp/data# ll
  3. total 3272
  4. drwxr-xr-x  2 root root    4096 Mar  7 21:01 ./
  5. drwxrwxrwt 13 root root    4096 Mar  7 21:02 ../
  6. -rw-r--r--  1 root root    3780 Mar  7 21:02 test-201303072101.log
  7. -rw-r--r--  1 root root 3336909 Mar  7 21:02 test-201303072101.tar.gz
  8. root@client2:/tmp/data# cat test-201303072101.log
  9. InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy
  10. and Percona Inc 2009-2012.  All Rights Reserved.
  11. This software is published under
  12. the GNU GENERAL PUBLIC LICENSE Version 2, June 1991.
  13. 130307 21:01:39  innobackupex: Starting mysql with options:  --defaults-file='/etc/mysql/my.cnf' --password=xxxxxxxx --user='root' --unbuffered --
  14. 130307 21:01:39  innobackupex: Connected to database with mysql child process (pid=12441)
  15. 130307 21:01:45  innobackupex: Connection to database server closed
  16. IMPORTANT: Please check that the backup run completes successfully.
  17. At the end of a successful backup run innobackupex
  18. prints "completed OK!".
  19. innobackupex: Using mysql  Ver 14.14 Distrib 5.5.28, for debian-linux-gnu (x86_64) using readline 6.2
  20. innobackupex: Using mysql server version Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
  21. innobackupex: Created backup directory /tmp/data
  22. 130307 21:01:45  innobackupex: Starting mysql with options:  --defaults-file='/etc/mysql/my.cnf' --password=xxxxxxxx --user='root' --unbuffered --
  23. 130307 21:01:45  innobackupex: Connected to database with mysql child process (pid=12471)
  24. 130307 21:01:47  innobackupex: Connection to database server closed
  25. 130307 21:01:47  innobackupex: Starting ibbackup with command: xtrabackup_55  --defaults-file="/etc/mysql/my.cnf" --backup --suspend-at-end --log-stream --target-dir=/tmp
  26. innobackupex: Waiting for ibbackup (pid=12478) to suspend
  27. innobackupex: Suspend file '/tmp/xtrabackup_suspended'
  28. xtrabackup: suspend-at-end is enabled.
  29. xtrabackup: uses posix_fadvise().
  30. xtrabackup: cd to /var/lib/mysql
  31. xtrabackup: Target instance is assumed as followings.
  32. xtrabackup:   innodb_data_home_dir = ./
  33. xtrabackup:   innodb_data_file_path = ibdata1:10M:autoextend
  34. xtrabackup:   innodb_log_group_home_dir = ./
  35. xtrabackup:   innodb_log_files_in_group = 2
  36. xtrabackup:   innodb_log_file_size = 5242880
  37. 130307 21:01:47 InnoDB: Using Linux native AIO
  38. xtrabackup: Stream mode.
  39. >> log scanned up to (59605543)
  40. 130307 21:01:49  innobackupex: Continuing after ibbackup has suspended
  41. innobackupex: Starting to backup InnoDB tables and indexes
  42. innobackupex: from original InnoDB data directory '/var/lib/mysql'
  43. innobackupex: Backing up as tar stream 'ibdata1'
  44. 130307 21:01:52  innobackupex: Starting mysql with options:  --defaults-file='/etc/mysql/my.cnf' --password=xxxxxxxx --user='root' --unbuffered --
  45. 130307 21:01:52  innobackupex: Connected to database with mysql child process (pid=12494)
  46. >> log scanned up to (59605543)
  47. 130307 21:01:54  innobackupex: Starting to lock all tables...
  48. >> log scanned up to (59605543)
  49. >> log scanned up to (59605543)
  50. 130307 21:02:04  innobackupex: All tables locked and flushed to disk
  51. 130307 21:02:04  innobackupex: Starting to backup .frm, .MRG, .MYD, .MYI,
  52. innobackupex: .TRG, .TRN, .ARM, .ARZ, .CSM, .CSV and .opt files in
  53. innobackupex: subdirectories of '/var/lib/mysql'
  54. innobackupex: Backing up file '/var/lib/mysql/test/test.frm'
  55. innobackupex: Backing up file '/var/lib/mysql/test/db.opt'
  56. 130307 21:02:04  innobackupex: Finished backing up .frm, .MRG, .MYD, .MYI, .TRG, .TRN, .ARM, .ARZ, .CSV, .CSM and .opt files
  57. innobackupex: Resuming ibbackup
  58. xtrabackup: The latest check point (for incremental): '59605543'
  59. >> log scanned up to (59605543)
  60. xtrabackup: Transaction log of lsn (59605543) to (59605543) was copied.
  61. 130307 21:02:06  innobackupex: All tables unlocked
  62. 130307 21:02:06  innobackupex: Connection to database server closed
  63. innobackupex: Backup created in directory '/tmp/data'
  64. innobackupex: MySQL binlog position: filename 'mysql-bin.000022', position 107
  65. innobackupex: You must use -i (--ignore-zeros) option for extraction of the tar stream.
  66. 130307 21:02:06  innobackupex: completed OK!
可以看到备份完成了
(3)恢复数据库
先关闭mysql服务,然后再删除test数据库文件
  1. root@client2:/tmp/data# service mysql stop
  2. mysql stop/waiting
  3. root@client2:/tmp/data# cd /var/lib/mysql/
  4. root@client2:/var/lib/mysql# ll
  5. total 77860
  6. drwx------  8 mysql mysql     4096 Mar  7 20:59 ./
  7. drwxr-xr-x 38 root  root      4096 Mar  7 19:52 ../
  8. -rw-r--r--  1 root  root         0 Jan  5 14:22 debian-5.5.flag
  9. drwx------  2 mysql mysql     4096 Feb 11 17:39 django/
  10. -rw-rw----  1 mysql mysql 69206016 Mar  7 21:02 ibdata1
  11. -rw-rw----  1 mysql mysql  5242880 Mar  7 21:02 ib_logfile0
  12. -rw-rw----  1 mysql mysql  5242880 Mar  7 21:01 ib_logfile1
  13. drwx------  2 mysql mysql     4096 Jan  5 22:55 monitor/
  14. drwx------  2 mysql root      4096 Jan  5 14:22 mysql/
  15. -rw-rw----  1 root  root         6 Jan  5 14:22 mysql_upgrade_info
  16. drwx------  2 mysql mysql     4096 Jan  5 14:22 performance_schema/
  17. drwx------  2 mysql mysql     4096 Mar  7 21:00 test/
  18. drwxr-xr-x  2 mysql mysql     4096 Mar  7 19:58 xtrbackup/
  19. root@client2:/var/lib/mysql# rm -rf test
  20. root@client2:/var/lib/mysql# ll
  21. total 77856
  22. drwx------  7 mysql mysql     4096 Mar  7 21:03 ./
  23. drwxr-xr-x 38 root  root      4096 Mar  7 19:52 ../
  24. -rw-r--r--  1 root  root         0 Jan  5 14:22 debian-5.5.flag
  25. drwx------  2 mysql mysql     4096 Feb 11 17:39 django/
  26. -rw-rw----  1 mysql mysql 69206016 Mar  7 21:02 ibdata1
  27. -rw-rw----  1 mysql mysql  5242880 Mar  7 21:02 ib_logfile0
  28. -rw-rw----  1 mysql mysql  5242880 Mar  7 21:01 ib_logfile1
  29. drwx------  2 mysql mysql     4096 Jan  5 22:55 monitor/
  30. drwx------  2 mysql root      4096 Jan  5 14:22 mysql/
  31. -rw-rw----  1 root  root         6 Jan  5 14:22 mysql_upgrade_info
  32. drwx------  2 mysql mysql     4096 Jan  5 14:22 performance_schema/
  33. drwxr-xr-x  2 mysql mysql     4096 Mar  7 19:58 xtrbackup/
开始恢复数据库
先把之前/tmp/data里的数据库压缩版给解压
  1. root@client2:cd /tmp/data
  2. root@client2:/tmp/data# tar -izxvf test-201303072101.tar.gz -C /tmp/restore/
  3. backup-my.cnf
  4. ibdata1
  5. xtrabackup_binlog_info
  6. test/test.frm
  7. test/db.opt
  8. xtrabackup_logfile
  9. xtrabackup_checkpoints
  10. xtrabackup_binary
注意:这里tar解包必须使用-i参数,否则解压出来的文件只有一个backup-my.cnf
查看一下restore的内容
  1. root@client2:/tmp/data# cd /tmp/restore/
  2. root@client2:/tmp/restore# ll
  3. total 67616
  4. drwxr-xr-x  3 root  root      4096 Mar  7 21:03 ./
  5. drwxrwxrwt 14 root  root      4096 Mar  7 21:03 ../
  6. -rw-r--r--  1 root  root       260 Mar  7 21:01 backup-my.cnf
  7. -rw-rw----  1 mysql mysql 69206016 Mar  7 21:01 ibdata1
  8. drwxr-xr-x  2 root  root      4096 Mar  7 21:03 test/
  9. -rw-r--r--  1 root  root        13 Mar  7 21:02 xtrabackup_binary
  10. -rw-r--r--  1 root  root        23 Mar  7 21:02 xtrabackup_binlog_info
  11. -rw-r--r--  1 root  root        79 Mar  7 21:02 xtrabackup_checkpoints
  12. -rw-r--r--  1 root  root      2560 Mar  7 21:02 xtrabackup_logfile

然后将备份文件中的日志应用到备份文件中的数据文件上

  1. root@client2:/tmp/restore# innobackupex --user=root --password=123456 --apply-log /tmp/restore/
  2. InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy
  3. and Percona Inc 2009-2012.  All Rights Reserved.
  4. This software is published under
  5. the GNU GENERAL PUBLIC LICENSE Version 2, June 1991.
  6. IMPORTANT: Please check that the apply-log run completes successfully.
  7. At the end of a successful apply-log run innobackupex
  8. prints "completed OK!".
  9. 130307 21:04:18  innobackupex: Starting ibbackup with command: xtrabackup_55  --defaults-file="/tmp/restore/backup-my.cnf" --prepare --target-dir=/tmp/restore
  10. xtrabackup_55 version 1.6.7 for Percona Server 5.5.16 Linux (x86_64) (revision id: undefined)
  11. xtrabackup: cd to /tmp/restore
  12. xtrabackup: This target seems to be not prepared yet.
  13. xtrabackup: xtrabackup_logfile detected: size=2097152, start_lsn=(59605543)
  14. xtrabackup: Temporary instance for recovery is set as followings.
  15. xtrabackup:   innodb_data_home_dir = ./
  16. xtrabackup:   innodb_data_file_path = ibdata1:10M:autoextend
  17. xtrabackup:   innodb_log_group_home_dir = ./
  18. xtrabackup:   innodb_log_files_in_group = 1
  19. xtrabackup:   innodb_log_file_size = 2097152
  20. 130307 21:04:19 InnoDB: Using Linux native AIO
  21. xtrabackup: Starting InnoDB instance for recovery.
  22. xtrabackup: Using 104857600 bytes for buffer pool (set by --use-memory parameter)
  23. 130307 21:04:19 InnoDB: The InnoDB memory heap is disabled
  24. 130307 21:04:19 InnoDB: Mutexes and rw_locks use GCC atomic builtins
  25. 130307 21:04:19 InnoDB: Compressed tables use zlib 1.2.3
  26. 130307 21:04:19 InnoDB: Using Linux native AIO
  27. 130307 21:04:19 InnoDB: Warning: innodb_file_io_threads is deprecated. Please use innodb_read_io_threads and innodb_write_io_threads instead
  28. 130307 21:04:19 InnoDB: Initializing buffer pool, size = 100.0M
  29. 130307 21:04:19 InnoDB: Completed initialization of buffer pool
  30. 130307 21:04:19 InnoDB: highest supported file format is Barracuda.
  31. InnoDB: The log sequence number in ibdata files does not match
  32. InnoDB: the log sequence number in the ib_logfiles!
  33. 130307 21:04:19  InnoDB: Database was not shut down normally!
  34. InnoDB: Starting crash recovery.
  35. InnoDB: Reading tablespace information from the .ibd files...
  36. InnoDB: Last MySQL binlog file position 0 107, file name /var/log/mysql/mysql-bin.000022
  37. 130307 21:04:20  InnoDB: Waiting for the background threads to start
  38. 130307 21:04:21 Percona XtraDB (http://www.percona.com) 1.1.8-20.1 started; log sequence number 59605543
  39. [notice (again)]
  40. If you use binary log and don't use any hack of group commit,
  41. the binary log position seems to be:
  42. InnoDB: Last MySQL binlog file position 0 107, file name /var/log/mysql/mysql-bin.000022
  43. xtrabackup: starting shutdown with innodb_fast_shutdown = 1
  44. 130307 21:04:21  InnoDB: Starting shutdown...
  45. 130307 21:04:25  InnoDB: Shutdown completed; log sequence number 59606758
  46. 130307 21:04:25  innobackupex: Restarting xtrabackup with command: xtrabackup_55  --defaults-file="/tmp/restore/backup-my.cnf" --prepare --target-dir=/tmp/restore
  47. for creating ib_logfile*
  48. xtrabackup_55 version 1.6.7 for Percona Server 5.5.16 Linux (x86_64) (revision id: undefined)
  49. xtrabackup: cd to /tmp/restore
  50. xtrabackup: This target seems to be already prepared.
  51. xtrabackup: notice: xtrabackup_logfile was already used to '--prepare'.
  52. xtrabackup: Temporary instance for recovery is set as followings.
  53. xtrabackup:   innodb_data_home_dir = ./
  54. xtrabackup:   innodb_data_file_path = ibdata1:10M:autoextend
  55. xtrabackup:   innodb_log_group_home_dir = ./
  56. xtrabackup:   innodb_log_files_in_group = 2
  57. xtrabackup:   innodb_log_file_size = 5242880
  58. 130307 21:04:25 InnoDB: Using Linux native AIO
  59. xtrabackup: Starting InnoDB instance for recovery.
  60. xtrabackup: Using 104857600 bytes for buffer pool (set by --use-memory parameter)
  61. 130307 21:04:25 InnoDB: The InnoDB memory heap is disabled
  62. 130307 21:04:25 InnoDB: Mutexes and rw_locks use GCC atomic builtins
  63. 130307 21:04:25 InnoDB: Compressed tables use zlib 1.2.3
  64. 130307 21:04:25 InnoDB: Using Linux native AIO
  65. 130307 21:04:25 InnoDB: Warning: innodb_file_io_threads is deprecated. Please use innodb_read_io_threads and innodb_write_io_threads instead
  66. 130307 21:04:25 InnoDB: Initializing buffer pool, size = 100.0M
  67. 130307 21:04:25 InnoDB: Completed initialization of buffer pool
  68. 130307 21:04:25  InnoDB: Log file ./ib_logfile0 did not exist: new to be created
  69. InnoDB: Setting log file ./ib_logfile0 size to 5 MB
  70. InnoDB: Database physically writes the file full: wait...
  71. 130307 21:04:25  InnoDB: Log file ./ib_logfile1 did not exist: new to be created
  72. InnoDB: Setting log file ./ib_logfile1 size to 5 MB
  73. InnoDB: Database physically writes the file full: wait...
  74. 130307 21:04:25 InnoDB: highest supported file format is Barracuda.
  75. InnoDB: The log sequence number in ibdata files does not match
  76. InnoDB: the log sequence number in the ib_logfiles!
  77. 130307 21:04:25  InnoDB: Database was not shut down normally!
  78. InnoDB: Starting crash recovery.
  79. InnoDB: Reading tablespace information from the .ibd files...
  80. InnoDB: Last MySQL binlog file position 0 107, file name /var/log/mysql/mysql-bin.000022
  81. 130307 21:04:26  InnoDB: Waiting for the background threads to start
  82. 130307 21:04:27 Percona XtraDB (http://www.percona.com) 1.1.8-20.1 started; log sequence number 59607052
  83. [notice (again)]
  84. If you use binary log and don't use any hack of group commit,
  85. the binary log position seems to be:
  86. InnoDB: Last MySQL binlog file position 0 107, file name /var/log/mysql/mysql-bin.000022
  87. xtrabackup: starting shutdown with innodb_fast_shutdown = 1
  88. 130307 21:04:27  InnoDB: Starting shutdown...
  89. 130307 21:04:31  InnoDB: Shutdown completed; log sequence number 59607052
  90. 130307 21:04:31  innobackupex: completed OK!
这里的--apply-log指明是将日志应用到数据文件上,完成之后将备份文件中的数据恢复到数据库中:
然后再查看一下当前目录内容
  1. root@client2:/tmp/restore# ll
  2. total 79904
  3. drwxr-xr-x  3 root  root      4096 Mar  7 21:04 ./
  4. drwxrwxrwt 14 root  root      4096 Mar  7 21:04 ../
  5. -rw-r--r--  1 root  root       260 Mar  7 21:01 backup-my.cnf
  6. -rw-rw----  1 mysql mysql 69206016 Mar  7 21:04 ibdata1
  7. -rw-r--r--  1 root  root   5242880 Mar  7 21:04 ib_logfile0
  8. -rw-r--r--  1 root  root   5242880 Mar  7 21:04 ib_logfile1
  9. drwxr-xr-x  2 root  root      4096 Mar  7 21:03 test/
  10. -rw-r--r--  1 root  root        13 Mar  7 21:02 xtrabackup_binary
  11. -rw-r--r--  1 root  root        23 Mar  7 21:02 xtrabackup_binlog_info
  12. -rw-r--r--  1 root  root        36 Mar  7 21:04 xtrabackup_binlog_pos_innodb
  13. -rw-r--r--  1 root  root        79 Mar  7 21:04 xtrabackup_checkpoints
  14. -rw-r--r--  1 root  root   2097152 Mar  7 21:04 xtrabackup_logfile
  15. 然后把test目录复制到/var/lib/mysql目录
  16. root@client2:/tmp/restore# rsync -avz test ib* /var/lib/mysql/
  17. sending incremental file list
  18. test/
  19. test/db.opt
  20. test/test.frm
  21. sent 381 bytes  received 54 bytes  870.00 bytes/sec
  22. total size is 8621  speedup is 19.82
  23. root@client2:/tmp/restore# cd /var/lib/mysql/
  24. root@client2:/var/lib/mysql# ll
  25. total 77860
  26. drwx------  8 mysql mysql     4096 Mar  7 21:06 ./
  27. drwxr-xr-x 38 root  root      4096 Mar  7 19:52 ../
  28. -rw-r--r--  1 root  root         0 Jan  5 14:22 debian-5.5.flag
  29. drwx------  2 mysql mysql     4096 Feb 11 17:39 django/
  30. -rw-rw----  1 mysql mysql 69206016 Mar  7 21:02 ibdata1
  31. -rw-rw----  1 mysql mysql  5242880 Mar  7 21:02 ib_logfile0
  32. -rw-rw----  1 mysql mysql  5242880 Mar  7 21:01 ib_logfile1
  33. drwx------  2 mysql mysql     4096 Jan  5 22:55 monitor/
  34. drwx------  2 mysql root      4096 Jan  5 14:22 mysql/
  35. -rw-rw----  1 root  root         6 Jan  5 14:22 mysql_upgrade_info
  36. drwx------  2 mysql mysql     4096 Jan  5 14:22 performance_schema/
  37. drwxr-xr-x  2 root  root      4096 Mar  7 21:03 test/
  38. drwxr-xr-x  2 mysql mysql     4096 Mar  7 19:58 xtrbackup/
然后再修改test的用户与组为mysql
  1. root@client2:/var/lib/mysql# chown -R mysql:mysql test
  2. root@client2:/var/lib/mysql# ll
  3. total 77860
  4. drwx------  8 mysql mysql     4096 Mar  7 21:06 ./
  5. drwxr-xr-x 38 root  root      4096 Mar  7 19:52 ../
  6. -rw-r--r--  1 root  root         0 Jan  5 14:22 debian-5.5.flag
  7. drwx------  2 mysql mysql     4096 Feb 11 17:39 django/
  8. -rw-rw----  1 mysql mysql 69206016 Mar  7 21:02 ibdata1
  9. -rw-rw----  1 mysql mysql  5242880 Mar  7 21:02 ib_logfile0
  10. -rw-rw----  1 mysql mysql  5242880 Mar  7 21:01 ib_logfile1
  11. drwx------  2 mysql mysql     4096 Jan  5 22:55 monitor/
  12. drwx------  2 mysql root      4096 Jan  5 14:22 mysql/
  13. -rw-rw----  1 root  root         6 Jan  5 14:22 mysql_upgrade_info
  14. drwx------  2 mysql mysql     4096 Jan  5 14:22 performance_schema/
  15. drwxr-xr-x  2 mysql mysql     4096 Mar  7 21:03 test/
  16. drwxr-xr-x  2 mysql mysql     4096 Mar  7 19:58 xtrbackup/
然后启动mysql,并查看test数据库的表里内容
  1. root@client2:/var/lib/mysql# service  mysql start
  2. mysql start/running, process 12730
  3. root@client2:/var/lib/mysql# mysql -u root -p
  4. Enter password:
  5. Welcome to the MySQL monitor.  Commands end with ; or \g.
  6. Your MySQL connection id is 36
  7. Server version: 5.5.28-0ubuntu0.12.04.3-log (Ubuntu)
  8. Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
  9. Oracle is a registered trademark of Oracle Corporation and/or its
  10. affiliates. Other names may be trademarks of their respective
  11. owners.
  12. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  13. mysql> use test;
  14. Reading table information for completion of table and column names
  15. You can turn off this feature to get a quicker startup with -A
  16. Database changed
  17. mysql> select * from test;
  18. +------+
  19. | id   |
  20. +------+
  21. |    1 |
  22. |    2 |
  23. |    3 |
  24. |    4 |
  25. |    5 |
  26. +------+
  27. 5 rows in set (0.01 sec)
可以看到数据库已经恢复完成
可能大家有个疑问,为什么我这里不像很多网上的文章里是在apply-log后,使用copy-back如果使用/usr/bin/innobackupex --copy-back命令后,会报Original data directory is not empty! at /usr/local/xtrabackup/bin/innobackupex line 538.恢复的目录必须为空。经查官网,这是xtrabackup的一个BUG。
innobackupexcopy-back was run. With this bug fix, innobackupexcopy-back operation if the destination is not empty, avoiding potential data loss or a strang combination of a restored backup and previous data. Bug Fixed: #737569 (Valentine Gostev) will now error out of the did not check that MySQL datadir was empty before
所以在apply-log后直接复制数据目录到数据库的位置上吧。
三、对数据库的增量备份与恢复
为了进行增量备份,先对数据库添加一些数据
  1. mysql> insert into test values(11);
  2. Query OK, 1 row affected (0.10 sec)
  3. mysql> insert into test values(12);
  4. Query OK, 1 row affected (0.05 sec)
  5. mysql> insert into test values(13);
  6. Query OK, 1 row affected (0.00 sec)
  7. mysql> insert into test values(14);
  8. Query OK, 1 row affected (0.00 sec)
  9. mysql> insert into test values(15);
  10. Query OK, 1 row affected (0.00 sec)
  11. mysql> flush privileges;
  12. Query OK, 0 rows affected (0.01 sec)
  13. mysql> select * from test;
  14. +------+
  15. | id   |
  16. +------+
  17. |    1 |
  18. |    2 |
  19. |    3 |
  20. |    4 |
  21. |    5 |
  22. |   11 |
  23. |   12 |
  24. |   13 |
  25. |   14 |
  26. |   15 |
  27. +------+
  28. 10 rows in set (0.00 sec)
然后进行增量的备份
  1. root@client2:/var/lib/mysql# innobackupex --user=root --password=123456 --database=test --incremental --incremental-basedir=/tmp/restore/ /tmp/data
  2. InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy
  3. and Percona Inc 2009-2012.  All Rights Reserved.
  4. This software is published under
  5. the GNU GENERAL PUBLIC LICENSE Version 2, June 1991.
  6. 130307 21:13:38  innobackupex: Starting mysql with options:  --password=xxxxxxxx --user='root' --unbuffered --
  7. 130307 21:13:38  innobackupex: Connected to database with mysql child process (pid=12864)
  8. 130307 21:13:44  innobackupex: Connection to database server closed
  9. IMPORTANT: Please check that the backup run completes successfully.
  10. At the end of a successful backup run innobackupex
  11. prints "completed OK!".
  12. innobackupex: Using mysql  Ver 14.14 Distrib 5.5.28, for debian-linux-gnu (x86_64) using readline 6.2
  13. innobackupex: Using mysql server version Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
  14. innobackupex: Created backup directory /tmp/data/2013-03-07_21-13-44
  15. 130307 21:13:44  innobackupex: Starting mysql with options:  --password=xxxxxxxx --user='root' --unbuffered --
  16. 130307 21:13:44  innobackupex: Connected to database with mysql child process (pid=12891)
  17. 130307 21:13:46  innobackupex: Connection to database server closed
  18. 130307 21:13:46  innobackupex: Starting ibbackup with command: xtrabackup_55 --backup --suspend-at-end --target-dir=/tmp/data/2013-03-07_21-13-44 --incremental-basedir='/tmp/restore/'
  19. innobackupex: Waiting for ibbackup (pid=12898) to suspend
  20. innobackupex: Suspend file '/tmp/data/2013-03-07_21-13-44/xtrabackup_suspended'
  21. xtrabackup_55 version 1.6.7 for Percona Server 5.5.16 Linux (x86_64) (revision id: undefined)
  22. incremental backup from 59605543 is enabled.
  23. xtrabackup: uses posix_fadvise().
  24. xtrabackup: cd to /var/lib/mysql
  25. xtrabackup: Target instance is assumed as followings.
  26. xtrabackup:   innodb_data_home_dir = ./
  27. xtrabackup:   innodb_data_file_path = ibdata1:10M:autoextend
  28. xtrabackup:   innodb_log_group_home_dir = ./
  29. xtrabackup:   innodb_log_files_in_group = 2
  30. xtrabackup:   innodb_log_file_size = 5242880
  31. 130307 21:13:46 InnoDB: Using Linux native AIO
  32. >> log scanned up to (59606124)
  33. [01] Copying ./ibdata1
  34. to /tmp/data/2013-03-07_21-13-44/ibdata1.delta
  35. [01]        ...done
  36. 130307 21:13:50  innobackupex: Continuing after ibbackup has suspended
  37. 130307 21:13:50  innobackupex: Starting mysql with options:  --password=xxxxxxxx --user='root' --unbuffered --
  38. 130307 21:13:50  innobackupex: Connected to database with mysql child process (pid=12913)
  39. >> log scanned up to (59606124)
  40. 130307 21:13:52  innobackupex: Starting to lock all tables...
  41. >> log scanned up to (59606124)
  42. >> log scanned up to (59606124)
  43. 130307 21:14:03  innobackupex: All tables locked and flushed to disk
  44. 130307 21:14:03  innobackupex: Starting to backup .frm, .MRG, .MYD, .MYI,
  45. innobackupex: .TRG, .TRN, .ARM, .ARZ, .CSM, .CSV and .opt files in
  46. innobackupex: subdirectories of '/var/lib/mysql'
  47. innobackupex: Backing up file '/var/lib/mysql/test/test.frm'
  48. innobackupex: Backing up file '/var/lib/mysql/test/db.opt'
  49. 130307 21:14:03  innobackupex: Finished backing up .frm, .MRG, .MYD, .MYI, .TRG, .TRN, .ARM, .ARZ, .CSV, .CSM and .opt files
  50. innobackupex: Resuming ibbackup
  51. xtrabackup: The latest check point (for incremental): '59606124'
  52. >> log scanned up to (59606124)
  53. xtrabackup: Stopping log copying thread.
  54. xtrabackup: Transaction log of lsn (59606124) to (59606124) was copied.
  55. 130307 21:14:05  innobackupex: All tables unlocked
  56. 130307 21:14:05  innobackupex: Connection to database server closed
  57. innobackupex: Backup created in directory '/tmp/data/2013-03-07_21-13-44'
  58. innobackupex: MySQL binlog position: filename 'mysql-bin.000023', position 107
  59. 130307 21:14:05  innobackupex: completed OK!
其中,--incremental指明是增量备份,--incremental-basedir指定上次完整备份或者增量备份文件的位置。这里的增量备份其实只针对的是InnoDB,对于MyISAM来说,还是完整备份。
在进行增量备份的恢复之前,先关闭数据库,然后删除数据库test
  1. root@client2:/var/lib/mysql# service mysql stop
  2. mysql stop/waiting
  3. root@client2:/var/lib/mysql# rm -rf test
  4. root@client2:/var/lib/mysql# ll
  5. total 77856
  6. drwx------  7 mysql mysql     4096 Mar  7 21:17 ./
  7. drwxr-xr-x 38 root  root      4096 Mar  7 19:52 ../
  8. -rw-r--r--  1 root  root         0 Jan  5 14:22 debian-5.5.flag
  9. drwx------  2 mysql mysql     4096 Feb 11 17:39 django/
  10. -rw-rw----  1 mysql mysql 69206016 Mar  7 21:17 ibdata1
  11. -rw-rw----  1 mysql mysql  5242880 Mar  7 21:17 ib_logfile0
  12. -rw-rw----  1 mysql mysql  5242880 Mar  7 21:11 ib_logfile1
  13. drwx------  2 mysql mysql     4096 Jan  5 22:55 monitor/
  14. drwx------  2 mysql root      4096 Jan  5 14:22 mysql/
  15. -rw-rw----  1 root  root         6 Jan  5 14:22 mysql_upgrade_info
  16. drwx------  2 mysql mysql     4096 Jan  5 14:22 performance_schema/
  17. drwxr-xr-x  2 mysql mysql     4096 Mar  7 19:58 xtrbackup/
增量备份的恢复
  1. root@client2:/var/lib/mysql# innobackupex -user=root --password=123456 --defaults-file=/etc/mysql/my.cnf --apply-log /tmp/restore/ --incremental-dir=/tmp/data/2013-03-07_21-13-44/
  2. InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy
  3. and Percona Inc 2009-2012.  All Rights Reserved.
  4. This software is published under
  5. the GNU GENERAL PUBLIC LICENSE Version 2, June 1991.
  6. IMPORTANT: Please check that the apply-log run completes successfully.
  7. At the end of a successful apply-log run innobackupex
  8. prints "completed OK!".
  9. 130307 21:18:20  innobackupex: Starting ibbackup with command: xtrabackup_55  --defaults-file="/etc/mysql/my.cnf" --prepare --target-dir=/tmp/restore --incremental-dir=/tmp/data/2013-03-07_21-13-44/
  10. xtrabackup_55 version 1.6.7 for Percona Server 5.5.16 Linux (x86_64) (revision id: undefined)
  11. incremental backup from 59605543 is enabled.
  12. xtrabackup: cd to /tmp/restore
  13. xtrabackup: This target seems to be already prepared.
  14. xtrabackup: xtrabackup_logfile detected: size=2097152, start_lsn=(59606124)
  15. xtrabackup: page size for /tmp/data/2013-03-07_21-13-44//ibdata1.delta is 16384 bytes
  16. Applying /tmp/data/2013-03-07_21-13-44//ibdata1.delta ...
  17. xtrabackup: Temporary instance for recovery is set as followings.
  18. xtrabackup:   innodb_data_home_dir = ./
  19. xtrabackup:   innodb_data_file_path = ibdata1:10M:autoextend
  20. xtrabackup:   innodb_log_group_home_dir = /tmp/data/2013-03-07_21-13-44/
  21. xtrabackup:   innodb_log_files_in_group = 1
  22. xtrabackup:   innodb_log_file_size = 2097152
  23. 130307 21:18:20 InnoDB: Using Linux native AIO
  24. xtrabackup: Starting InnoDB instance for recovery.
  25. xtrabackup: Using 104857600 bytes for buffer pool (set by --use-memory parameter)
  26. 130307 21:18:20 InnoDB: The InnoDB memory heap is disabled
  27. 130307 21:18:20 InnoDB: Mutexes and rw_locks use GCC atomic builtins
  28. 130307 21:18:20 InnoDB: Compressed tables use zlib 1.2.3
  29. 130307 21:18:20 InnoDB: Using Linux native AIO
  30. 130307 21:18:20 InnoDB: Warning: innodb_file_io_threads is deprecated. Please use innodb_read_io_threads and innodb_write_io_threads instead
  31. 130307 21:18:20 InnoDB: Initializing buffer pool, size = 100.0M
  32. 130307 21:18:20 InnoDB: Completed initialization of buffer pool
  33. 130307 21:18:20 InnoDB: highest supported file format is Barracuda.
  34. InnoDB: ##########################################################
  35. InnoDB:                          WARNING!
  36. InnoDB: The log sequence number in ibdata files is higher
  37. InnoDB: than the log sequence number in the ib_logfiles! Are you sure
  38. InnoDB: you are using the right ib_logfiles to start up the database?
  39. InnoDB: Log sequence number in ib_logfiles is 59606124, log
  40. InnoDB: sequence numbers stamped to ibdata file headers are between
  41. InnoDB: 59607052 and 59607052.
  42. InnoDB: ##########################################################
  43. InnoDB: The log sequence number in ibdata files does not match
  44. InnoDB: the log sequence number in the ib_logfiles!
  45. 130307 21:18:20  InnoDB: Database was not shut down normally!
  46. InnoDB: Starting crash recovery.
  47. InnoDB: Reading tablespace information from the .ibd files...
  48. InnoDB: Last MySQL binlog file position 0 107, file name /var/log/mysql/mysql-bin.000023
  49. 130307 21:18:29  InnoDB: Waiting for the background threads to start
  50. 130307 21:18:30 Percona XtraDB (http://www.percona.com) 1.1.8-20.1 started; log sequence number 59606124
  51. [notice (again)]
  52. If you use binary log and don't use any hack of group commit,
  53. the binary log position seems to be:
  54. InnoDB: Last MySQL binlog file position 0 107, file name /var/log/mysql/mysql-bin.000023
  55. xtrabackup: starting shutdown with innodb_fast_shutdown = 1
  56. 130307 21:18:30  InnoDB: Starting shutdown...
  57. 130307 21:18:34  InnoDB: Shutdown completed; log sequence number 59607339
  58. innobackupex: Starting to copy non-InnoDB files in '/tmp/data/2013-03-07_21-13-44/'
  59. innobackupex: to the full backup directory '/tmp/restore'
  60. innobackupex: Copying '/tmp/data/2013-03-07_21-13-44/xtrabackup_binlog_info' to '/tmp/restore/xtrabackup_binlog_info'
  61. innobackupex: Copying '/tmp/data/2013-03-07_21-13-44/test/test.frm' to '/tmp/restore/test/test.frm'
  62. innobackupex: Copying '/tmp/data/2013-03-07_21-13-44/test/db.opt' to '/tmp/restore/test/db.opt'
  63. 130307 21:18:34  innobackupex: completed OK!
然后再进入恢复的目录/tmp/data
  1. root@client2:/var/lib/mysql# cd /tmp/data
  2. root@client2:/tmp/data# ll
  3. total 3276
  4. drwxr-xr-x  3 root root    4096 Mar  7 21:13 ./
  5. drwxrwxrwt 14 root root    4096 Mar  7 21:18 ../
  6. drwxr-xr-x  3 root root    4096 Mar  7 21:18 2013-03-07_21-13-44/
  7. -rw-r--r--  1 root root    3780 Mar  7 21:02 test-201303072101.log
  8. -rw-r--r--  1 root root 3336909 Mar  7 21:02 test-201303072101.tar.gz
  9. root@client2:/tmp/data# cd 2013-03-07_21-13-44/
  10. root@client2:/tmp/data/2013-03-07_21-13-44# ll
  11. total 2288
  12. drwxr-xr-x 3 root root    4096 Mar  7 21:18 ./
  13. drwxr-xr-x 3 root root    4096 Mar  7 21:13 ../
  14. -rw-r--r-- 1 root root     260 Mar  7 21:13 backup-my.cnf
  15. -rw-r--r-- 1 root root  212992 Mar  7 21:13 ibdata1.delta
  16. -rw-r--r-- 1 root root      18 Mar  7 21:13 ibdata1.meta
  17. drwxr-xr-x 2 root root    4096 Mar  7 21:14 test/
  18. -rw-r--r-- 1 root root      13 Mar  7 21:14 xtrabackup_binary
  19. -rw-r--r-- 1 root root      23 Mar  7 21:14 xtrabackup_binlog_info
  20. -rw-r--r-- 1 root root      84 Mar  7 21:14 xtrabackup_checkpoints
  21. -rw-r--r-- 1 root root 2097152 Mar  7 21:18 xtrabackup_logfile
跟全部备份一样,把test恢复到/var/lib/mysql里
  1. root@client2:/tmp/data/2013-03-07_21-13-44# rsync -avz test ib* /var/lib/mysql/
  2. sending incremental file list
  3. test/
  4. test/db.opt
  5. test/test.frm
  6. sent 381 bytes  received 54 bytes  870.00 bytes/sec
  7. total size is 8621  speedup is 19.82
  8. root@client2:/tmp/data/2013-03-07_21-13-44# cd /var/lib/mysql/
  9. root@client2:/var/lib/mysql# ll
  10. total 77860
  11. drwx------  8 mysql mysql     4096 Mar  7 21:19 ./
  12. drwxr-xr-x 38 root  root      4096 Mar  7 19:52 ../
  13. -rw-r--r--  1 root  root         0 Jan  5 14:22 debian-5.5.flag
  14. drwx------  2 mysql mysql     4096 Feb 11 17:39 django/
  15. -rw-rw----  1 mysql mysql 69206016 Mar  7 21:17 ibdata1
  16. -rw-rw----  1 mysql mysql  5242880 Mar  7 21:17 ib_logfile0
  17. -rw-rw----  1 mysql mysql  5242880 Mar  7 21:11 ib_logfile1
  18. drwx------  2 mysql mysql     4096 Jan  5 22:55 monitor/
  19. drwx------  2 mysql root      4096 Jan  5 14:22 mysql/
  20. -rw-rw----  1 root  root         6 Jan  5 14:22 mysql_upgrade_info
  21. drwx------  2 mysql mysql     4096 Jan  5 14:22 performance_schema/
  22. drwxr-xr-x  2 root  root      4096 Mar  7 21:14 test/
  23. drwxr-xr-x  2 mysql mysql     4096 Mar  7 19:58 xtrbackup/
然后修改用户与组
  1. root@client2:/var/lib/mysql# chown -R mysql:mysql test/
  2. root@client2:/var/lib/mysql# ll
  3. total 77860
  4. drwx------  8 mysql mysql     4096 Mar  7 21:19 ./
  5. drwxr-xr-x 38 root  root      4096 Mar  7 19:52 ../
  6. -rw-r--r--  1 root  root         0 Jan  5 14:22 debian-5.5.flag
  7. drwx------  2 mysql mysql     4096 Feb 11 17:39 django/
  8. -rw-rw----  1 mysql mysql 69206016 Mar  7 21:17 ibdata1
  9. -rw-rw----  1 mysql mysql  5242880 Mar  7 21:17 ib_logfile0
  10. -rw-rw----  1 mysql mysql  5242880 Mar  7 21:11 ib_logfile1
  11. drwx------  2 mysql mysql     4096 Jan  5 22:55 monitor/
  12. drwx------  2 mysql root      4096 Jan  5 14:22 mysql/
  13. -rw-rw----  1 root  root         6 Jan  5 14:22 mysql_upgrade_info
  14. drwx------  2 mysql mysql     4096 Jan  5 14:22 performance_schema/
  15. drwxr-xr-x  2 mysql mysql     4096 Mar  7 21:14 test/
  16. drwxr-xr-x  2 mysql mysql     4096 Mar  7 19:58 xtrbackup/
然后启动msyql,并查看test数据库里test表的内容
  1. root@client2:/var/lib/mysql# service mysql start
  2. mysql start/running, process 13109
  3. root@client2:/var/lib/mysql# mysql -u root -p
  4. Enter password:
  5. Welcome to the MySQL monitor.  Commands end with ; or \g.
  6. Your MySQL connection id is 36
  7. Server version: 5.5.28-0ubuntu0.12.04.3-log (Ubuntu)
  8. Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
  9. Oracle is a registered trademark of Oracle Corporation and/or its
  10. affiliates. Other names may be trademarks of their respective
  11. owners.
  12. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  13. mysql> use test
  14. Reading table information for completion of table and column names
  15. You can turn off this feature to get a quicker startup with -A
  16. Database changed
  17. mysql> select * from test;
  18. +------+
  19. | id   |
  20. +------+
  21. |    1 |
  22. |    2 |
  23. |    3 |
  24. |    4 |
  25. |    5 |
  26. |   11 |
  27. |   12 |
  28. |   13 |
  29. |   14 |
  30. |   15 |
  31. +------+
  32. 10 rows in set (0.00 sec)
可以看到增量备份已经恢复完成。

下面的链接是我在生产环境适应xtrabackup来恢复全部备份的数据库的案例

http://dl528888.blog.51cto.com/2382721/1153207

本文转自 reinxu 51CTO博客,原文链接:http://blog.51cto.com/dl528888/1153204,如需转载请自行联系原作者

生产环境究竟是使用mysqldump还是xtrabackup来备份与恢复数据库?相关推荐

  1. 生产环境运行Docker的9个关键决策

    本文讲的是生产环境运行Docker的9个关键决策,[编者的话]生产环境运行Docker并没有想象的那么简单,如何实现稳定安全的部署和扩容? 又有哪些需要考虑的关键决策? 本文就此做了一些分析和阐述,赶 ...

  2. 生产环境如何关闭报错功能_知识分享---如何区分前端与后端bug

    1.如何区分前端和后端 通俗讲,用户看到的部分都叫前端. 而用户看不到的部分可以统称为后端. 2.前端和后端的呈现形式 前端的呈现形式有web端.移动端(ios.安卓).小程序等. 后端系统一般只有一 ...

  3. mysql备份工具 :mysqldump mydumper Xtrabackup 原理

    备份是数据安全的最后一道防线,对于任何数据丢失的场景,备份虽然不一定能恢复百分之百的数据(取决于备份周期),但至少能将损失降到最低.衡量备份恢复有两个重要的指标:恢复点目标(RPO)和恢复时间目标(R ...

  4. MySQL数据库备份: mysqldump VS xtrabackup

    MySQL数据库备份工具比较 最近使用了公司的一个项目管理工具进行团队任务管理,本来这个工具使用起来很方便的,但是前几天突然发现最近一段时间做的更新操作全都消失不见了,找工具的运维人员也恢复不回来,感 ...

  5. 生产环境主从数据同步不了?

    生产环境主从数据同步不了? 经历过程: 一般我们常常在做主从复制的时候,可能是很少遇到到错误,那都是因为,你做主从基本用的是,本地虚拟机做,或者一些测试环境做.但是当我们把主从复制部署到生成环境就出问 ...

  6. 生产环境 JVM 内存溢出案例分析

    点击上方蓝色"方志朋",选择"设为星标" 回复"666"获取独家整理的学习资料! 来源:blog.csdn.net/prestigeding ...

  7. 生产环境JVM内存溢出案例分析

    如果我们所在公司的业务量比较大,在生产环境经常会出现JVM内存溢出的现象,那我们该如何快速响应,快速定位,快速恢复问题呢? 本文将通过一个线上环境JVM内存溢出的案例向大家介绍一下处理思路与分析方法. ...

  8. 生产环境JVM内存溢出案例分析!

    点击上方 好好学java ,选择 星标 公众号 重磅资讯.干货,第一时间送达 今日推荐:Nginx 为什么快到根本停不下来? 个人原创100W+访问量博客:点击前往,查看更多 来源:blog.csdn ...

  9. TokuDB在生产环境的应用场景(zabbix也可以)

    一 .背景介绍 近年来,TokuDB作为MySQL的大数据(Big Data)存储引擎受到人们的普遍关注.其架构的核心基于一种新的叫做分形树(Fractal Trees)的索引数据结构,该结构是缓存无 ...

最新文章

  1. Metasploit profiling工具的利用
  2. 十五天精通WCF——第十四天 一起聊聊FaultException
  3. hashmap::begin() 坑
  4. 简单的计算机试题,这么简单的MS Office试题基础,一般人都不好意思看!
  5. [java] 虚拟机(JVM)底层结构详解[转]
  6. vue function (i)第一次点击不执行_vue下$nextTick及原理浅析
  7. 【ZooKeeper Notes 5】单机启动多个zk实例注意点
  8. java底层 文件操作,java底层是怎样对文件操作的
  9. LTE学习笔记:频带、信道带宽和频点号EARFCN
  10. 一文详解 NanoHttpd 微型服务器原理
  11. 《美国工厂》:一座中国工厂在数万英里之外的异域镜像
  12. 数字藏品文博周将至,拙政园主题数字藏品全网首发
  13. 禁用ubuntu16.04的guest账户
  14. 魅族便签,是否能成为国内便签应用的No.1?
  15. 增强 扫描王 源码_OpenCV探索之路(二十二):制作一个类“全能扫描王”的简易扫描软件...
  16. vue实现自动语音播报功能,未解决。(已用js解决20220210)
  17. 详解 Benders 分解与一个算例的 python 代码
  18. Twincat3 Win32 Error:577
  19. 什么副业来钱快?有什么靠谱的副业可以做?
  20. 领峰:黄金价格走势图的分析你懂吗?

热门文章

  1. phpstduy8 redisClient 2.0 点不了_关于以太坊 2.0,你想知道的都在这里
  2. 一款打包免签分发平台源码+搭建说明
  3. 百度SEO最新小某云商城系统源码 免授权V1.61版
  4. 移动端设备判断,ios,android,判断设备,安卓
  5. 短网址缩短和还原综合源码
  6. 全网最新Redis结合Kaptcha实现验证码功能篇二(前后端分离)
  7. Magento 添加 google font Adding a google fonts into Magento
  8. 在 CodeIgniter 中使用 jQuery 实现 AJAX
  9. Python_实现简单贝叶斯分类
  10. 人工智障学习笔记——机器学习(5)朴素贝叶斯