xtrabackup: innodb_log_file_size = 268435456
xtrabackup: using the following InnoDB configuration for recovery:
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
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: 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: Setting log file ./ib_logfile101 size to 256 MB
InnoDB: Progress in MB: 100 200
InnoDB: Setting log file ./ib_logfile1 size to 256 MB
InnoDB: Progress in MB: 100 200
InnoDB: Setting log file ./ib_logfile2 size to 256 MB
InnoDB: Progress in MB: 100 200
InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
InnoDB: New log files created, LSN=6118588408
InnoDB: Highest supported file format is Barracuda.
InnoDB: 128 rollback segment(s) are active.
InnoDB: Waiting for purge to start
InnoDB: 5.6.17 started; log sequence number 6118588428
[notice (again)]
If you use binary log and don't use any hack of group commit,
the binary log position seems to be:
InnoDB: Last MySQL binlog file position 0 324258362, file name ./mysql-bin.000008
xtrabackup: starting shutdown with innodb_fast_shutdown = 1
InnoDB: FTS optimize thread exiting.
InnoDB: Starting shutdown...
InnoDB: Shutdown completed; log sequence number 6118588438
140731 11:28:26 innobackupex: completed OK!
NDMC74:~ #?
Master上创建同步账号并授权REPLICATION
mysql> CREATE USER 'repl'@'192.168.223.%' IDENTIFIED BY 'replpass';
Query OK, 0 rows affected (0.02 sec)
mysql> GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'repl'@'192.168.223.%';
Query OK, 0 rows affected (0.02 sec)
然后在Slave上测试,看看能否使用repl用户登录Master服务器:
NDMC75:~ # mysql -h192.168.223.132 -urepl -preplpass
mysql> show grants\G
*************************** 1. row ***************************
Grants for repl@192.168.223.%: GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'repl'@'192.168.223.%' IDENTIFIED BY PASSWORD '*D98280F03D0F78162EBDBB9C883FC01395DEA2BF'
1 row in set (0.00 sec)?
将Master的全备scp到Slave主机上
NDMC74:~ # cd /data/backup/innobackupex/
NDMC74:/data/backup/innobackupex # scp -r ./2014-07-31_11-20-44 192.168.223.133:/data/backup
将Slave上的MySQL停掉,然后将Master的备份文件放到Slave的datadir目录下:
NDMC75:~ # mv /data/backup/2014-07-31_11-20-44 /data/mysql/mysql3306/data
NDMC75:~ # cd /data/mysql/mysql3306
NDMC75:/data/mysql/mysql3306 # chown -R mysql:mysql data
注意:Slave的my.cnf文件和Master的一样,只是修改一下server-id即可。
启动Slave
数据库
NDMC75:~ # /usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf &
NDMC75:~ # ps -ef |grep mysqld
mysql 1293 1 1 11:50 pts/0 00:00:01 /usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf
root 3124 19598 0 11:51 pts/0 00:00:00 grep mysqld
同时查看一下error.log文件,看看有没有错误信息。
在slave上执行change master设置主服务器复制信息
Master binlog信息从备份文件中可以获得:
NDMC74:~ # cd /data/backup/innobackupex/2014-07-31_11-20-44
NDMC74:~ # cat xtrabackup_binlog_info
mysql-bin.000009 376
mysql> change master to ma