In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
1.centos7 installation (centos6 can go to the official download of the corresponding version)
Wget https://www.percona.com/downloads/XtraBackup/Percona-XtraBackup-2.4.7/binary/redhat/7/x86_64/percona-xtrabackup-24-2.4.7-2.el7.x86_64.rpmyum localinstall percona-xtrabackup-24-2.4.7-2.el7.x86_64.rpm
two。 Use backup (full backup)
Innobackupex-- user=root-- password=123456 / home/backupdb/ [root@master 2017-07-17 July 01-55-14] # pwd/home/backupdb/2017-07-17 July 01-55-14 [root@master 2017-07-17 July 01-55-14] # lltotal 18456 Rwashi r-1 root root 417 Jul 17 01:55 backup-my.cnf-rw-r- 1 root root 18874368 Jul 17 01:55 ibdata1drwxr-x--- 2 root root 4096 Jul 17 01:55 mysqldrwxr-x--- 2 root root 4096 Jul 17 01:55 performance_schemadrwxr-x--- 2 root root 19 Jul 17 01:55 test-rw-r- 1 root root 113Jul 17 01:55 xtrabackup_checkpoints-rw-r- 1 root root 432 Jul 17 01:55 xtrabackup_info-rw-r- 1 root root 2560 Jul 17 01:55 xtrabackup_ log [root @ master 2017- 07-17 root root 01-55-14] # generate backup log innobackupex-- user=root-- password=123456-- apply-log / home/backupdb/2017-07-17 July 01-52-14 [root@master 2017-07-17 July 01-55-14] # lltotal 49172 Rwashi r-1 root root 417 Jul 17 01:55 backup-my.cnf-rw-r- 1 root root 18874368 Jul 17 01:56 ibdata1-rw-r -1 root root 5242880 Jul 17 01:56 ib_logfile0-rw-r- 1 root root 5242880 Jul 17 01:56 ib_logfile1-rw-r- 1 root root 12582912 Jul 17 01:56 ibtmp1drwxr-x--- 2 root root 4096 Jul 17 01:55 mysqldrwxr-x--- 2 root root 4096 Jul 17 01:55 performance_schemadrwxr-x--- 2 root root 19 Jul 17 01:55 test-rw-r- 1 root root 113 Jul 17 01:56 xtrabackup_checkpoints-rw-r- 1 root root 432 Jul 17 01:55 xtrabackup_info-rw-r- 1 root root 8388608 Jul 17 01:56 xtrabackup_logfile
3. Restore (restore all)
[root@master 2017-07-170001-55-14] # ps-ef | grep mysql mysql 2434 10 01:47? 00:00:00 / bin/sh / usr/bin/mysqld_safe-- basedir=/usrmysql 2591 2434 0 01:47? 00:00:00 / usr/libexec/mysqld-- basedir=/usr-- datadir=/var/lib/mysql-- plugin-dir=/usr/lib64/mysql/plugin-- log-error=/var/ Log/mariadb/mariadb.log-- pid-file=/var/run/mariadb/mariadb.pid-- socket=/var/lib/mysql/mysql.sockroot 2879 2126: 57 pts/0 00:00:00 grep-- color=auto mysql [root@master 2017-07-170001-55-14] # cd / var/lib/mysql/ [root@master mysql] # lsaria_log.00000001 aria_log_control ibdata1 ib_logfile0 ib_logfile1 mysql mysql.sock performance_schema test [root@ Master mysql] # lltotal 28700 RW Jul-1 mysql mysql 16384 Jul 17 01:47 aria_log.00000001-rw-rw---- 1 mysql mysql 52 Jul 17 01:47 aria_log_control-rw-rw---- 1 mysql mysql 18874368 Jul 17 01:47 ibdata1-rw-rw---- 1 mysql mysql 5242880 Jul 17 01:47 ib_logfile0-rw-rw---- 1 mysql mysql 5242880 Jul 17 01:47 ib_logfile1drwx- 2 mysql Mysql 4096 Jul 17 01:47 mysqlsrwxrwxrwx 1 mysql mysql 0 Jul 17 01:47 mysql.sockdrwx- 2 mysql mysql 4096 Jul 17 01:47 performance_schemadrwx- 2 mysql mysql 6 Jul 17 01:47 test [root@master mysql] # rm-rf test [root@master mysql] # [root@master mysql] # systemctl stop mariadb [root@master mysql] # rm-rf / var/lib/mysql/* restore and start the data Library innobackupex-- defaults-file=/etc/my.cnf-- copy-back / home/backupdb/2017-07-17Secret01-55-14 / the data restored by default is that the root permission database cannot start chown-R mysql.mysql / var/lib/mysql [root@master mysql] # systemctl start mariadb [root@master mysql] # mysql-uroot-p123456Welcome to the MariaDB monitor. Commands end with; or\ g.Your MariaDB connection id is 2Server version: 5.5.52-MariaDB MariaDB ServerCopyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.Type 'help;' or'\ h' for help. Type'\ c' to clear the current input statement.MariaDB [(none)] > MariaDB [(none)] > show databases +-+ | Database | +-+ | information_schema | | mysql | | performance_schema | | test | +-+ 4 rows in set (0.00 sec) MariaDB [(none)] > all data are returned
4. Incremental backup
Mkdir-p / home/backupdb/ {1pi 2 3} [root@master backupdb] # innobackupex-- defaults-file=/etc/my.cnf-- user=root-- password=123456 / home/backupdb/1/ incremental backup innobackupex-- defaults-file=/etc/my.cnf-- incremental / home/backupdb/2/-- incremental-basedir=/home/backupdb/1/2017-07-17room02-16-32 /-- user=root-- password=123456--incremental incremental backup to that directory if the database is changed Which directory is the incremental-basedir based on for incremental backup? if the database is modified again, innobackupex-- defaults-file=/etc/my.cnf-- incremental / home/backupdb/3/-- incremental-basedir=/home/backupdb/2/2017-07-178.02-19-47 /-- user=root-- password=123456
5. Data recovery of incremental backup
Recover all the data for the first time first.
Innobackupex-- defaults-file=/etc/my.cnf-- copy-back / home/backupdb/1/2017-07-17 February 02-16-32 /
two。 Incremental recovery
Innobackupex-- apply-log-- redo-only / home/backupdb/1/2017-07-17002-16-32/innobackupex-- apply-log-- redo-only / home/backupdb/1/2017-07-17002-16-32 /-incremental-dir=/home/backupdb/2/2017-07-17002-19-47/innobackupex-- apply-log-- redo-only / home/backupdb/1/2017-07-1702216-32 /-- incremental -dir=/home/backupdb/3/2017-07-170223-41 /
3. Recover data
Innobackupex-- copy-back / home/backupdb/1/2017-07-178.02-16-32 /
4. You can see that the data has come back.
[root@master mysql] # ll / var/lib/mysql/total 18444 RW root root r-1 root root 18874368 Jul 17 02:41 ibdata1drwxr-x--- 2 root root 4096 Jul 17 02:41 mysqldrwxr-x--- 2 root root 4096 Jul 17 02:41 performance_schemadrwxr-x--- 2 root root 19 Jul 17 02:41 testdrwxr-x--- 2 root root 19 Jul 17 02:41 test02-rw-r- 1 root root 542 Jul 17 02:41 xtrabackup_ info [root @ master mysql] # chown-R mysql.mysql * [root@master mysql] #
5. Start the database
[root@master lib] # systemctl start mariadb [root@master lib] # mysql-uroot-p123456Welcome to the MariaDB monitor. Commands end with; or\ g.Your MariaDB connection id is 2Server version: 5.5.52-MariaDB MariaDB ServerCopyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.MariaDB [(none)] > show databases +-+ | Database | +-+ | information_schema | | mysql | | performance_schema | | test | | test02 | +-+ 5 rows in set (0.00 sec) MariaDB [(none)] >
When backing up extrabackup, backing up mysql is not compatible with this installation
I am the backup mariadb.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.