In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
# get the download address
Wget https://www.percona.com/downloads/XtraBackup/Percona-XtraBackup-2.3.3/binary/redhat/6/x86_64/percona-xtrabackup-2.3.3-1.el6.x86_64.rpm
Yum install percona-xtrabackup-2.3.3-1.el6.x86_64.rpm
# full backup
Innobackupex-user=root-password=123456 / db_bak
# restore, restore the database by replicating the entire structure. Stop mysql service is required before execution, otherwise unpredictable errors will occur.
Service mysqld stop
# the recovery will still report / var/lib/mysql/ is not empty at this time, and all files in the / var/lib/mysql/ directory need to be deleted
Cd / var/lib/mysql/
Rm-rf / var/lib/mysql/*
# full recovery
Innobackupex-- user=root-- password=123456-- apply-log / db_bak/2016-01-13,14-21-24 /-the step of writing back the log is indispensable.
Innobackupex-- user=root-- password=123456-- copy-back / db_bak/2016-01-13 14-21-24 /
# set permissions. After restoration, it is found that the permissions are all root and need to be modified to mysql. At this step, the full restore is completed. Remember to restart the service.
Chown-R mysql:mysql / var/lib/mysql/
Service mysqld start
# incremental backup
Innobackupex-- user=root-- password=123456-- incremental-basedir=/db_bak/2016-01-13,14-21-24-- incremental / db_bak
# incremental backup recovery:
# apply all incremental backups to the data files of the full backup one by one, and then restore the data from the full backup to the database
# stop mysql service (must)
Service mysqld stop
# Delete data files
Cd / var/lib/mysql/
Rm-rf / var/lib/mysql/*
# redo full backup log
Innobackupex-- apply-log-- redo-only / db_bak/2016-01-13 14-21-24 /
# apply the first incremental backup
Innobackupex-- user=root-- password=123456-- apply-log / db_bak/2016-01-13 14-21-24 /-- incremental-dir=/db_bak/2016-01-14 11-47-00 /
# the log has been written to the full backup. Just redo the full backup
Innobackupex-- user=root-- password=123456-- apply-log / db_bak/2016-01-13,14-21-24 /-the step of writing back the log is indispensable.
Innobackupex-- user=root-- password=123456-- copy-back / db_bak/2016-01-13 14-21-24 /
# Delete mysql logs, which can be reduced step by step
Ib_logfile0 and ib_logfile1 files under the MySQL directory
Cd / var/lib/mysql/
Cp ib_logfile0 ib_logfile0_bak
Cp ib_logfile1 ib_logfile1_bak
Rm-rf ib_logfile0
Rm-rf ib_logfile1
# set permissions. After restoration, it is found that the permissions are all root and need to be modified to mysql. At this step, the full restore is completed. Remember to restart the service.
Chown-R mysql:mysql / var/lib/mysql/
Service mysqld start
# data corruption or copied innodb but log discrepancy occurs
Need to set up
Innodb_force_recovery=6
Innodb_purge_thread=0
Restart the service
Then export the database logical backup in mysqldump
Before changing the setting to the default
Innodb_force_recovery=0
Innodb_purge_thread=1
Just restart the service and restore the database.
MySQL Plugin 'InnoDB' init function returned error.
Delete the ib_logfile0 and ib_logfile1 files in the MySQL directory to solve the problem.
Mysql will regenerate the two logs
# remote backup, backup to 10.50.85.104, sshpass is required
Cd / etc/yum.repos.d
Wget http://download.opensuse.org/repositories/home:Strahlex/CentOS_CentOS-6/home:Strahlex.repo
Yum install sshpass
# Compression
Innobackupex-- user=root-- password=123456-- stream=tar. / | gzip | sshpass-p 'WCcj1Fylr5Hcsubscription 'ssh root@10.50.85.104 "cat-> / var/db_bak/backup.tar.gz"
# back up the mysiam table
Myisam tables are backed up by issuing the command flush tables with read lock, and then copying the related table files of myisam.
So at this point, you can only read, not write anything. Here, the pointer is directed to all libraries.
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: 242
*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.