环境描述
| 主从环境 |
? |
? |
| 项目 |
Master |
Slave |
| OS版本 |
SuSE 11sp1 x86_64 |
SuSE 11sp1 x86_64 |
| MySQL版本 |
官方版本5.5.37 |
官方版本5.5.37 |
| hostname |
NDMC74 |
NDMC75 |
| IP |
192.168.223.132 |
192.168.223.133 |
| PORT |
3306 |
3306 |
| server-id |
1323306 |
1333306 |
| 参数文件 |
/etc/my.cnf |
/etc/my.cnf |
| DATADIR |
/data/mysql/mysql3306/data |
/data/mysql/mysql3306/data |
主从库相关配置确认
(1)server-id配置
Master节点:
NDMC74:~ # mysql -S /tmp/mysql.sock -e "show global variables like 'server_id';"
+---------------+---------+
| Variable_name | Value |
+---------------+---------+
| server_id | 1323306 |
+---------------+---------+
Slaver节点:
NDMC75:~ # mysql -S /tmp/mysql.sock -e "show global variables like 'server_id';"
+---------------+---------+
| Variable_name | Value |
+---------------+---------+
| server_id | 1333306 |
+---------------+---------+
(2)确认binlog是否开启
NDMC74:~ # mysql -S /tmp/mysql.sock -e "show global variables like 'log_bin';"
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| log_bin | ON |
+---------------+-------+
Master上使用xtrabackup做全库备份
NDMC74:~ # innobackupex --defaults-file=/etc/my.cnf /data/backup/innobackupex
InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy
and Percona LLC and/or its affiliates 2009-2013. All Rights Reserved.
This software is published under
the GNU GENERAL PUBLIC LICENSE Version 2, June 1991.
Get the latest version of Percona XtraBackup, documentation, and help resources:
http://www.percona.com/xb/p
140731 11:20:44 innobackupex: Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_file=/etc/my.cnf;mysql_read_default_group=xtrabackup' (using password: NO).
140731 11:20:44 innobackupex: Connected to MySQL server
140731 11:20:44 innobackupex: Executing a version check against the server...
140731 11:20:44 innobackupex: Done.
IMPORTANT: Please check that the backup run completes successfully.
At the end of a successful backup run innobackupex
prints "completed OK!".
innobackupex: Using mysql server version 5.5.37-log
innobackupex: Created backup directory /data/backup/innobackupex/2014-07-31_11-20-44
140731 11:20:44 innobackupex: Starting ibbackup with command: xtrabackup --defaults-file="/etc/my.cnf" --defaults-group="mysqld" --backup --suspend-at-end --target-dir=/data/backup/innobackupex/2014-07-31_11-20-44 --tmpdir=/tmp --extra-lsndir='/tmp'
innobackupex: Waiting for ibbackup (pid=25767) to suspend
innobackupex: Suspend file '/data/backup/innobackupex/2014-07-31_11-20-44/xtrabackup_suspended_2'
xtrabackup version 2.2.3 based on MySQL server 5.6.17 Linux (x86_64) (revision id: )
xtrabackup: uses posix_fadvise().
xtrabackup: cd to /data/mysql/mysql3306/data
xtrabackup: open files limit requested 8192, set to 8192
xtrabackup: using the following InnoDB configuration:
xtrabackup: innodb_data_home_dir = ./
xtrabackup: innodb_data_file_path = ibdata1:1G:autoextend
xtrabackup: innodb_log_group_home_dir = ./
xtrabackup: innodb_log_files_in_group = 3
xtrabackup: innodb_log_file_size = 268435456
>> log scanned up to (6118588398)
[01] Copying ./ibdata1 to /data/backup/innobackupex/2014-07-31_11-20-44/ibdata1
>> log scanned up to (6118588398)
>> log scanned up to (6118588398)
>> log scanned up to (6118588398)
>> log scanned up to (6118588398)
>> log scanned up to (6118588398)