Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Xtrabackup study notes

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Wget https://www.percona.com/downloads/XtraBackup/Percona-XtraBackup-2.4.7/binary/tarball/percona-xtrabackup-2.4.7-Linux-x86_64.tar.gz

Yum-y install perl perl-devel libaio libaio-devel perl-Time-HiRes perl-DBD-MySQL numactl-y

Yum install numactl-y

Mv bin/* / sbin/

3. Hot backup

Xtrabackup project

Innobackupex is a perl script encapsulated with xtrabackup, which is usually backed up.

Backup:

Innobackupex-defaults-file=/etc/my.cnf-user=root-password=123456 / bak/

Restore:

1./etc/init.d/mysql stop

two。 Delete data files and transaction log files from the old database

Recovery log

3.innobackupex-defaults-file=/etc/my.cnf-apply-log / bak/2013-

Recover data

4.innobackupex-defaults-file=/etc/my.cnf-copy-back / bak/2013-

5.chown-R mysql.mysql / data/

6./etc/init.d/mysql start

Full recovery:

1. Full backup

Innobackupex-defaults-file=/etc/my.cnf / bak/fullbak/

two。 Incremental backup

Innobackupex-defaults-file=/etc/my.cnf-incremental / bak/incrementbak/-incremental-basedir=/bak/fullbak/2013 (date) /

Cd fullbak/2013 (date) /

Incremental recovery:

1./etc/init.d/mysql stop

1. Restore the incremental transaction log first

Innobackupex-apply-log-read-only / bak/fullbak/

two。 Then restore the full transaction log

Innobackupex-apply-log / bak/fullbak/

3. Restore the data from the backup file to the database

Innobackupex-copy-back / bak/fullbak/

4.chown-R mysql.mysql / data/

5. / etc/init.d/msyql start

SHOW MASTER STATUS

Show slave stats\ G

Mysql > GRANT REPLICATION SLAVE ON *. * TO 'repl'@'%' IDENTIFIED BY' replpassword'

Mysql > CHANGE MASTER TO MASTER_HOST = 'dbmaster', MASTER_USER =' repl', MASTER_PASSWORD = 'replpassword', MASTER_PORT = 3306, MASTER_LOG_FILE =' mysql-bin.000001', MASTER_LOG_POS = 643

Start slave

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report