In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces how to use xtrabackup to back up and restore mysql, the content is very detailed, interested friends can refer to, hope to be helpful to you.
1. Install percona-xtrabackup
# download the installation package:
# cd / usr/local/src# wget https://www.percona.com/downloads/XtraBackup/Percona-XtraBackup-2.3.2/binary/redhat/6/x86_64/percona-xtrabackup-2.3.2-1.el6.x86_64.rpm
# install dependent libraries:
# yum-y install perl perl-devel libaio libaio-devel perl-Time-HiRes perl-DBD-MySQL# wget ftp://rpmfind.net/linux/dag/redhat/el6/en/x86_64/dag/RPMS/libev-4.15-1.el6.rf.x86_64.rpm # rpm-ivh libev-4.15-1.el6.rf.x86_64.rpm# rpm-ivh percona-xtrabackup-2.3.2-1.el6.x86_64.rpm
# create a directory for backup:
# mkdir-p / databackup/fullbackup# mkdir-p / databackup/increasebackup
# create backup users and authorizations:
Mysql > grant SELECT,RELOAD,SHOW DATABASES,SUPER,LOCK TABLES,REPLICATION CLIENT,SHOW VIEW,EVENT,FILE on *. * to backup@'localhost' identified by 'MANAGER'
2. Back up 3306 instances:
# innobackupex-- defaults-file=/data/3306/my.cnf-- socket=/data/3306/mysql.sock-- user=backup-- password='MANAGER' / mysqlbackup/fullbackup/3306
Description:
-- defaults-file, which specifies the configuration file of the mysql instance
-- socket, specify the location of the socket
-- user, specify the user of the backup
-- password, specify the user name
/ mysqlbackup/fullbackup/3306, here we back up the instance to the / mysqlbackup/fullbackup/3306 directory
# du-sh / mysqlbackup/fullbackup/3306130M / mysqlbackup/fullbackup/3306# ls-lrt / mysqlbackup/fullbackup/3306/* Total usage 131136 emsdrwx- emsdrwx--1 root root 134217728 October 12 04:32 ibdata1drwx- 2 root root 4096 October 12 04:32 jamesdrwx- 2 root root 4096 October 12 04:32 emsdrwx- 2 root root 4096 October 12 04:32 mysqldrwx- 2 root root October 12 04:32 performance_schemadrwx- 2 root root 4096 October 12 04:32 wh510drwx- 2 root root 4096 October 12 04:32 wwwdrwx- 2 root root 4096 October 12 04:32 blogdrwx- 2 root root 4096 October 12 04:32 oparkdrwx- 2 root root 4096 October 12 04:32 dawnprodrwx- 2 root root 4096 October 12 04:32 eipdrwx- 2 root root 4096 October 12 04:32 hangzhou_dawnpro-rw-r- 1 root root 21 October 12 04:32 xtrabackup_binlog_info-rw-r- 1 root root 2560 October 12 04:32 xtrabackup_logfile-rw-r- 1 root root 113 October 12 04:32 xtrabackup_checkpoints-rw-r- 1 root root 386 October 12 04:32 backup-my.cnf-rw-r- 1 root root 551 October 12 04:32 xtrabackup_info
3. Simulation 3306 data file is missing
# rm-rf / data/3306/data# lsof-I: 3306
Description: at this time, the database is no longer working properly. Check the error log and find that there is no data directory.
161012 04:40:35 mysqld_safe mysqld from pid file / data/3306/mysqld.pid ended
161012 04:42:10 mysqld_safe Starting mysqld daemon with databases from / data/3306/data
161012 4:42:10 [Warning] Can't create test file / data/3306/data/mysql-master.lower-test
161012 4:42:10 [Warning] Can't create test file / data/3306/data/mysql-master.lower-test
/ application/mysql-5.5.32/bin/mysqld: Can't change dir to'/ data/3306/data/' (Errcode: 2)
161012 4:42:10 [ERROR] Aborting
161012 4:42:10 [Note] / application/mysql-5.5.32/bin/mysqld: Shutdown complete
161012 04:42:10 mysqld_safe mysqld from pid file / data/3306/mysqld.pid ended
4. Mysql complete data recovery:
# mkdir-p / data/3306/data
# for general recovery, it is directly restored with a backup file. If we also directly use the backup file here, it may lead to some unexpected problems. For example, the backed up data may contain transactions that have not yet been committed or transactions that have been committed but have not been synchronized to the data file. Therefore, at this time, the data file is in an inconsistent state, and we are now trying to make the data file consistent by rolling back the uncommitted transaction and synchronizing the committed transaction to the data file. So we need to check with the following command:
# innobackupex-- apply-log-- redo-only / mysqlbackup/fullbackup/3306/2016-10-12004-32-49 /
161012 04:53:07 innobackupex: Starting the apply-log operation
IMPORTANT: Please check that the apply-log run completes successfully.
At the end of a successful apply-log run innobackupex
Prints "completed OK!".
Innobackupex version 2.3.2 based on MySQL server 5.6.24 Linux (x86x64) (revision id: 306a2e0)
Xtrabackup: cd to / mysqlbackup/fullbackup/3306/2016-10-12 04-32-49 /
Xtrabackup: This target seems to be already prepared with-- apply-log-only.
Xtrabackup: notice: xtrabackup_logfile was already used to'--prepare'.
Xtrabackup: using the following InnoDB configuration for recovery:
Xtrabackup: innodb_data_home_dir =. /
Xtrabackup: innodb_data_file_path = ibdata1:10M:autoextend
Xtrabackup: innodb_log_group_home_dir =. /
Xtrabackup: innodb_log_files_in_group = 2
Xtrabackup: innodb_log_file_size = 50331648
Xtrabackup: using the following InnoDB configuration for recovery:
Xtrabackup: innodb_data_home_dir =. /
Xtrabackup: innodb_data_file_path = ibdata1:10M:autoextend
Xtrabackup: innodb_log_group_home_dir =. /
Xtrabackup: innodb_log_files_in_group = 2
Xtrabackup: innodb_log_file_size = 50331648
Xtrabackup: Starting InnoDB instance for recovery.
Xtrabackup: Using 104857600 bytes for buffer pool (set by-use-memory parameter)
InnoDB: Using atomics to ref count buffer pool pages
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use GCC atomic builtins
InnoDB: Memory barrier is not used
InnoDB: Compressed tables use zlib 1.2.3
InnoDB: Using CPU crc32 instructions
InnoDB: Initializing buffer pool, size = 100.0m
InnoDB: Completed initialization of buffer pool
InnoDB: Highest supported file format is Barracuda.
Xtrabackup: Last MySQL binlog file position 2442, file name / data/3306/mysql-bin.000008
Xtrabackup: starting shutdown with innodb_fast_shutdown = 1
InnoDB: Starting shutdown...
InnoDB: Shutdown completed; log sequence number 1606678
161012 04:53:08 completed OK!
# innobackupex-- defaults-file=/data/3306/my.cnf-- copy-back / mysqlbackup/fullbackup/3306/2016-10-12004-32-49 /
161012 04:56:32 innobackupex: Starting the copy-back operation
IMPORTANT: Please check that the copy-back run completes successfully.
At the end of a successful copy-back run innobackupex
Prints "completed OK!".
Innobackupex version 2.3.2 based on MySQL server 5.6.24 Linux (x86x64) (revision id: 306a2e0)
161012 04:56:32 [01] Copying ib_logfile0 to / data/3306/data/ib_logfile0
161012 04:56:33 [01]... done
161012 04:56:33 [01] Copying ib_logfile1 to / data/3306/data/ib_logfile1
161012 04:56:34 [01]... done
161012 04:56:34 [01] Copying ibdata1 to / data/3306/data/ibdata1
161012 04:56:36 [01]... done
161012 04:56:36 [01] Copying. / james/db.opt to / data/3306/data/james/db.opt
161012 04:56:36 [01]... done
161012 04:56:36 [01] Copying. / ems/db.opt to / data/3306/data/ems/db.opt
161012 04:56:36 [01]... done
161012 04:56:36 [01] Copying. / mysql/func.MYD to / data/3306/data/mysql/func.MYD
161012 04:56:36 [01]... done
161012 04:56:36 [01] Copying. / mysql/time_zone.MYD to / data/3306/data/mysql/time_zone.MYD
161012 04:56:36 [01]... done
161012 04:56:36 [01] Copying. / mysql/help_topic.MYD to / data/3306/data/mysql/help_topic.MYD
161012 04:56:36 [01]... done
161012 04:56:36 [01] Copying. / mysql/tables_priv.MYI to / data/3306/data/mysql/tables_priv.MYI
161012 04:56:36 [01]... done
161012 04:56:36 [01] Copying. / mysql/db.MYD to / data/3306/data/mysql/db.MYD
161012 04:56:36 [01]... done
161012 04:56:36 [01] Copying. / mysql/proc.frm to / data/3306/data/mysql/proc.frm
161012 04:56:36 [01]... done
161012 04:56:36 [01] Copying. / mysql/help_relation.MYI to / data/3306/data/mysql/help_relation.MYI
161012 04:56:36 [01]... done
161012 04:56:36 [01] Copying. / mysql/proxies_priv.MYI to / data/3306/data/mysql/proxies_priv.MYI
161012 04:56:36 [01]... done
161012 04:56:36 [01] Copying. / mysql/func.frm to / data/3306/data/mysql/func.frm
161012 04:56:36 [01]... done
161012 04:56:36 [01] Copying. / mysql/plugin.MYD to / data/3306/data/mysql/plugin.MYD
161012 04:56:36 [01]... done
161012 04:56:36 [01] Copying. / mysql/user.frm to / data/3306/data/mysql/user.frm
161012 04:56:36 [01]... done
161012 04:56:36 [01] Copying. / mysql/time_zone_transition.MYD to / data/3306/data/mysql/time_zone_transition.MYD
161012 04:56:36 [01]... done
161012 04:56:36 [01] Copying. / mysql/time_zone_transition_type.MYD to / data/3306/data/mysql/time_zone_transition_type.MYD
161012 04:56:36 [01]... done
161012 04:56:36 [01] Copying. / mysql/general_log.CSV to / data/3306/data/mysql/general_log.CSV
161012 04:56:36 [01]... done
161012 04:56:36 [01] Copying. / mysql/event.MYI to / data/3306/data/mysql/event.MYI
161012 04:56:36 [01]... done
161012 04:56:36 [01] Copying. / mysql/time_zone_leap_second.frm to / data/3306/data/mysql/time_zone_leap_second.frm
161012 04:56:36 [01]... done
161012 04:56:36 [01] Copying. / mysql/help_relation.frm to / data/3306/data/mysql/help_relation.frm
161012 04:56:36 [01]... done
161012 04:56:36 [01] Copying. / mysql/ndb_binlog_index.MYD to / data/3306/data/mysql/ndb_binlog_index.MYD
161012 04:56:36 [01]... done
161012 04:56:36 [01] Copying. / mysql/procs_priv.frm to / data/3306/data/mysql/procs_priv.frm
161012 04:56:36 [01]... done
161012 04:56:36 [01] Copying. / mysql/db.frm to / data/3306/data/mysql/db.frm
161012 04:56:36 [01]... done
161012 04:56:36 [01] Copying. / mysql/event.frm to / data/3306/data/mysql/event.frm
161012 04:56:36 [01]... done
161012 04:56:36 [01] Copying. / mysql/plugin.MYI to / data/3306/data/mysql/plugin.MYI
161012 04:56:36 [01]... done
161012 04:56:36 [01] Copying. / mysql/help_category.frm to / data/3306/data/mysql/help_category.frm
161012 04:56:36 [01]... done
161012 04:56:36 [01] Copying. / mysql/time_zone_name.MYD to / data/3306/data/mysql/time_zone_name.MYD
161012 04:56:36 [01]... done
161012 04:56:36 [01] Copying. / mysql/event.MYD to / data/3306/data/mysql/event.MYD
161012 04:56:36 [01]... done
161012 04:56:36 [01] Copying. / mysql/proc.MYI to / data/3306/data/mysql/proc.MYI
161012 04:56:36 [01]... done
161012 04:56:36 [01] Copying. / mysql/tables_priv.MYD to / data/3306/data/mysql/tables_priv.MYD
161012 04:56:36 [01]... done
161012 04:56:36 [01] Copying. / mysql/servers.frm to / data/3306/data/mysql/servers.frm
161012 04:56:36 [01]... done
161012 04:56:36 [01] Copying. / mysql/time_zone_leap_second.MYI to / data/3306/data/mysql/time_zone_leap_second.MYI
161012 04:56:36 [01]... done
161012 04:56:37 [01] Copying. / mysql/proxies_priv.MYD to / data/3306/data/mysql/proxies_priv.MYD
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/procs_priv.MYI to / data/3306/data/mysql/procs_priv.MYI
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/time_zone.MYI to / data/3306/data/mysql/time_zone.MYI
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/slow_log.CSV to / data/3306/data/mysql/slow_log.CSV
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/time_zone_transition.frm to / data/3306/data/mysql/time_zone_transition.frm
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/procs_priv.MYD to / data/3306/data/mysql/procs_priv.MYD
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/help_topic.MYI to / data/3306/data/mysql/help_topic.MYI
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/user.MYI to / data/3306/data/mysql/user.MYI
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/help_keyword.MYD to / data/3306/data/mysql/help_keyword.MYD
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/db.MYI to / data/3306/data/mysql/db.MYI
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/func.MYI to / data/3306/data/mysql/func.MYI
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/servers.MYI to / data/3306/data/mysql/servers.MYI
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/help_category.MYD to / data/3306/data/mysql/help_category.MYD
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/host.MYI to / data/3306/data/mysql/host.MYI
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/time_zone.frm to / data/3306/data/mysql/time_zone.frm
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/help_category.MYI to / data/3306/data/mysql/help_category.MYI
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/proxies_priv.frm to / data/3306/data/mysql/proxies_priv.frm
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/general_log.frm to / data/3306/data/mysql/general_log.frm
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/help_keyword.frm to / data/3306/data/mysql/help_keyword.frm
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/proc.MYD to / data/3306/data/mysql/proc.MYD
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/columns_priv.MYI to / data/3306/data/mysql/columns_priv.MYI
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/slow_log.frm to / data/3306/data/mysql/slow_log.frm
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/help_topic.frm to / data/3306/data/mysql/help_topic.frm
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/help_keyword.MYI to / data/3306/data/mysql/help_keyword.MYI
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/time_zone_name.MYI to / data/3306/data/mysql/time_zone_name.MYI
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/host.MYD to / data/3306/data/mysql/host.MYD
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/columns_priv.MYD to / data/3306/data/mysql/columns_priv.MYD
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/user.MYD to / data/3306/data/mysql/user.MYD
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/ndb_binlog_index.frm to / data/3306/data/mysql/ndb_binlog_index.frm
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/tables_priv.frm to / data/3306/data/mysql/tables_priv.frm
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/general_log.CSM to / data/3306/data/mysql/general_log.CSM
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/time_zone_leap_second.MYD to / data/3306/data/mysql/time_zone_leap_second.MYD
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/servers.MYD to / data/3306/data/mysql/servers.MYD
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/host.frm to / data/3306/data/mysql/host.frm
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/time_zone_name.frm to / data/3306/data/mysql/time_zone_name.frm
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/help_relation.MYD to / data/3306/data/mysql/help_relation.MYD
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/time_zone_transition.MYI to / data/3306/data/mysql/time_zone_transition.MYI
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/slow_log.CSM to / data/3306/data/mysql/slow_log.CSM
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/ndb_binlog_index.MYI to / data/3306/data/mysql/ndb_binlog_index.MYI
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/columns_priv.frm to / data/3306/data/mysql/columns_priv.frm
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/time_zone_transition_type.MYI to / data/3306/data/mysql/time_zone_transition_type.MYI
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/time_zone_transition_type.frm to / data/3306/data/mysql/time_zone_transition_type.frm
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / mysql/plugin.frm to / data/3306/data/mysql/plugin.frm
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / performance_schema/events_waits_summary_by_instance.frm to / data/3306/data/performance_schema/events_waits_summary_by_instance.frm
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / performance_schema/file_instances.frm to / data/3306/data/performance_schema/file_instances.frm
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / performance_schema/performance_timers.frm to / data/3306/data/performance_schema/performance_timers.frm
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / performance_schema/file_summary_by_event_name.frm to / data/3306/data/performance_schema/file_summary_by_event_name.frm
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / performance_schema/events_waits_summary_by_thread_by_event_name.frm to / data/3306/data/performance_schema/events_waits_summary_by_thread_by_event_name.frm
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / performance_schema/events_waits_current.frm to / data/3306/data/performance_schema/events_waits_current.frm
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / performance_schema/setup_instruments.frm to / data/3306/data/performance_schema/setup_instruments.frm
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / performance_schema/threads.frm to / data/3306/data/performance_schema/threads.frm
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / performance_schema/file_summary_by_instance.frm to / data/3306/data/performance_schema/file_summary_by_instance.frm
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / performance_schema/events_waits_history.frm to / data/3306/data/performance_schema/events_waits_history.frm
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / performance_schema/rwlock_instances.frm to / data/3306/data/performance_schema/rwlock_instances.frm
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / performance_schema/setup_consumers.frm to / data/3306/data/performance_schema/setup_consumers.frm
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / performance_schema/setup_timers.frm to / data/3306/data/performance_schema/setup_timers.frm
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / performance_schema/events_waits_summary_global_by_event_name.frm to / data/3306/data/performance_schema/events_waits_summary_global_by_event_name.frm
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / performance_schema/mutex_instances.frm to / data/3306/data/performance_schema/mutex_instances.frm
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / performance_schema/events_waits_history_long.frm to / data/3306/data/performance_schema/events_waits_history_long.frm
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / performance_schema/cond_instances.frm to / data/3306/data/performance_schema/cond_instances.frm
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / performance_schema/db.opt to / data/3306/data/performance_schema/db.opt
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / wh510/db.opt to / data/3306/data/wh510/db.opt
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / www/db.opt to / data/3306/data/www/db.opt
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / xtrabackup_info to / data/3306/data/xtrabackup_info
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / blog/db.opt to / data/3306/data/blog/db.opt
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / xtrabackup_binlog_pos_innodb to / data/3306/data/xtrabackup_binlog_pos_innodb
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / opark/person.frm to / data/3306/data/opark/person.frm
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / opark/db.opt to / data/3306/data/opark/db.opt
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / dawnpro/db.opt to / data/3306/data/dawnpro/db.opt
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / eip/db.opt to / data/3306/data/eip/db.opt
161012 04:56:37 [01]... done
161012 04:56:37 [01] Copying. / hangzhou_dawnpro/db.opt to / data/3306/data/hangzhou_dawnpro/db.opt
161012 04:56:37 [01]... done
161012 04:56:37 completed OK!
Note: when innobackup's copy-back is used to perform recovery operations, it copies all data-related files to the MySQL data directory, so the data directory needs to be emptied.
[root@mysql-master data] # ll / data/3306/data Total usage 229432drwx-2 root root 4096 October 12 04:56 blogdrwx- 2 root root 4096 October 12 04:56 dawnprodrwx- 2 root root 4096 October 12 04:56 eipdrwx- 2 root root 4096 October 12 04:56 emsdrwx- 2 root root 4096 October 12 04:56 hangzhou_dawnpro-rw- R-1 root root 134217728 October 12 04:56 ibdata1-rw-r- 1 root root 50331648 October 12 04:56 ib_logfile0-rw-r- 1 root root 50331648 October 12 04:56 ib_logfile1drwx- 2 root root 4096 October 12 04:56 jamesdrwx- 2 root root 4096 October 12 04:56 mysqldrwx- 2 root root 4096 October 12 04:56 oparkdrwx-- -2 root root 4096 October 12 04:56 performance_schemadrwx- 2 root root 4096 October 12 04:56 wh510drwx- 2 root root 4096 October 12 04:56 www-rw-r- 1 root root 33 October 12 04:56 xtrabackup_bin
5. Change database directory permissions
# chown-R mysql.mysql / data/3306/data
6. Enable mysql service
Start mysql and find that you cannot get up. Check the log information as follows (InnoDB: Error: logfile. / ib_logfile0 is of different size 0 50331648 bytes):
# tail-15 mysql_oldboy3306.err
161012 5:00:15 InnoDB: Mutexes and rw_locks use GCC atomic builtins
161012 5:00:15 InnoDB: Compressed tables use zlib 1.2.3
161012 5:00:15 InnoDB: Using Linux native AIO
161012 5:00:15 InnoDB: Initializing buffer pool, size = 32.0m
161012 5:00:15 InnoDB: Completed initialization of buffer pool
InnoDB: Error: logfile. / ib_logfile0 is of different size 0 50331648 bytes
InnoDB: than specified in the .cnf file 0 4194304 bytes!
161012 5:00:15 [ERROR] Plugin 'InnoDB' init function returned error.
161012 5:00:15 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
161012 5:00:15 [ERROR] Unknown/unsupported storage engine: InnoDB
161012 5:00:15 [ERROR] Aborting
161012 5:00:15 [Note] / application/mysql-5.5.32/bin/mysqld: Shutdown complete
161012 05:00:15 mysqld_safe mysqld from pid file / data/3306/mysqld.pid ended
# rm ib_logfile*-rf# / data/3306/mysql start# netstat-tunlp | grep 3306tcp 0 0 0.0.0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
7. Enter the database for verification
# mysql-uroot-predhat12345-S / data/3306/mysql.sockmysql > show databases +-+ | Database | +-+ | information_schema | | blog | | dawnpro | | eip | | ems | | hangzhou_dawnpro | | james | | mysql | | opark | | performance_schema | | wh510 | | www | +-+ 12 rows in set (0.01sec) this is all about how to use xtrabackup to back up and restore mysql. I hope the above content can be of some help to you and learn more knowledge. If you think the article is good, you can share it for more people to see.
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.