日期:2014-05-16  浏览次数:20513 次

利用Xtrabackup备份集合恢复一台从库的过程
1 time tar -xvf Open..tarx.gz

real    35m22.502s
user    10m16.499s
sys     1m28.578s
You have new mail in /var/spool/mail/root
PS:  Open..tarx.gzv 大小80G


2 time innobackupex --user=xxx --password=xxxx --defaults-file=/etc/my.cnf  --apply-log /home/alldb/
real    1m14.259s
user    0m0.356s
sys     0m2.672s
You have new mail in /var/spool/mail/root


3 copy以及chown
PS:磁盘空间不足,所以不能执行copyback,直接MV了。
mv /home/alldb/* /data/xxxx/open/ 
chown -R mysql.mysql /data/xxxx/open/


4 启动 service mysqld start
用5.5.20的mysql启动报错如下:
121221 10:40:36 mysqld_safe Starting mysqld daemon with databases from /data/md/open
121221 10:40:36 [Note] Flashcache bypass: disabled
121221 10:40:36 [Note] Flashcache setup error is : ioctl failed


121221 10:40:36 InnoDB: The InnoDB memory heap is disabled
121221 10:40:36 InnoDB: Mutexes and rw_locks use GCC atomic builtins
121221 10:40:36 InnoDB: Compressed tables use zlib 1.2.3
121221 10:40:36 InnoDB: Initializing buffer pool, size = 4.9G
121221 10:40:37 InnoDB: Completed initialization of buffer pool
121221 10:40:37 InnoDB: Error: data file /data/md/open/ibdata2 uses page size 1024,
121221 10:40:37 InnoDB: but the only supported page size in this release is=16384
121221 10:40:37 InnoDB: Could not open or create data files.
121221 10:40:37 InnoDB: If you tried to add new data files, and it failed here,
121221 10:40:37 InnoDB: you should now edit innodb_data_file_path in my.cnf back
121221 10:40:37 InnoDB: to what it was, and remove the new ibdata files InnoDB created
121221 10:40:37 InnoDB: in this failed attempt. InnoDB only wrote those files full of
121221 10:40:37 InnoDB: zeros, but did not yet use them in any way. But be careful: do not
121221 10:40:37 InnoDB: remove old data files which contain your precious data!
121221 10:40:37 [ERROR] Plugin 'InnoDB' init function returned error.
121221 10:40:37 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
121221 10:40:37 [ERROR] Unknown/unsupported storage engine: InnoDB
121221 10:40:37 [ERROR] Aborting


121221 10:40:37 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete


121221 10:40:37 mysqld_safe mysqld from pid file /data/md/open/test-db-20058.pid ended


5 google很久,看到说mysql升级到5.5的时候也报but the only supported page size in this release is=16384的错误,
于是就找原来版本5.1的安装目录,用mysqld_safe启动,ok,搞定
sudo /usr/local/mysql-5.1.56/bin/mysqld_safe --basedir=/usr/local/mysql-5.1.56/ --datadir=/data/md/open --user=mysql &


6 mysql 登录正常,验证slave:


mysql> grant all on *.* to 'tim'@'%' identified by 'xxxxx';


mysql> change master to master_user='repl', master_password='xxx#@!xxxx', master_host='90.60.201.30', master_log_file='mysql-bin.000449',master_log_pos=831708136;


mysql> start slave;


mysql> show slave status\G;
*************************** 1. row ***************************
               Slave_IO_State: 
                  Master_Host: 90.60.201.30
                  Master_User: repl
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.000449
          Read_Master_Log_Pos: 831708239
              &nbs