利用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
               Relay_Log_File: mb-bbs-db3-relay-bin.003261
                Relay_Log_Pos: 3914557
        Relay_Master_Log_File: mysql-bin.000449
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB: 
          Replicate_Ignore_DB: 
           Replicate_Do_Table: 
       Replicate_Ignore_Table: 
      Replicate_Wild_Do_Table: 
  Replicate_Wild_Ignore_Table: 
                   Last_Errno: 0
                   Last_Error: 
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 831708239
              Relay_Log_Space: 3940542
              Until_Condition: None
               Until_Log_File: 
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File: 
           Master_SSL_CA_Path: 
              Master_SSL_Cert: 
            Master_SSL_Cipher: 
               Master_SSL_Key: 
        Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error: 
               Last_SQL_Errno: 0
               Last_SQL_Error: 
1 row in set (0.00 sec)


ERROR: 
No query specified

你可能感兴趣的:(利用Xtrabackup备份集合恢复一台从库的过程)