Not the answer you need?
Register and ask your own question!

[SOLVED] Having trouble with restoration

EphemeralAttentionEphemeralAttention EntrantInactive User Role Beginner
Hi,

I am planning to use XtraBackup on production mysql servers but so far I am having trouble performing a successfull backup / restore.

The backup seems to go okay. I have tried the following commands for the backup:


innobackupex --user=root --password=supercoolpass-- /tmp/backup/</pre>

Everything seems to go okay:

innobackupex: Backup created in directory '/tmp/backup/2012-01-29_19-42-54'innobackupex: MySQL binlog position: filename '', position120129 19:43:18 innobackupex: completed OK!</pre>


Now when I try to perform a restoration, the following happens:


# innobackupex --copy-back /tmp/backup/2012-01-29_19-42-54/InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oyand Percona Inc 2009-2011. All Rights Reserved.This software is published underthe GNU GENERAL PUBLIC LICENSE Version 2, June 1991.IMPORTANT: Please check that the copy-back run completes successfully. At the end of a successful copy-back run innobackupex prints "completed OK!".Original data directory is not empty! at /usr/bin/innobackupex line 503.</pre>


So I did some (a lot of) reading and found that 'ls /var/lib/mysql/' must return empty', and I tried the following:


[[email protected] ~]# /etc/init.d/mysqld stop[[email protected] ~]# mkdir /tmp/mysql[[email protected] ~]# mv /var/lib/mysql/* /tmp/mysql/[[email protected] ~]# ls /var/lib/mysql[[email protected] ~]#</pre>


Now when I run the restoration, it appears to work:


[[email protected] ~]# innobackupex --copy-back /tmp/backup/2012-01-29_19-42-54/InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oyand Percona Inc 2009-2011. All Rights Reserved.This software is published underthe GNU GENERAL PUBLIC LICENSE Version 2, June 1991.IMPORTANT: Please check that the copy-back run completes successfully. At the end of a successful copy-back run innobackupex prints "completed OK!".innobackupex: Starting to copy MyISAM tables, indexes,innobackupex: .MRG, .TRG, .TRN, .ARM, .ARZ, .CSM, .CSV, .opt, and .frm filesinnobackupex: in '/tmp/backup/2012-01-29_19-42-54'innobackupex: back to original data directory '/var/lib/mysql'--ommitted---innobackupex: Finished copying back files.</pre>


But now MySQL will not start:


[[email protected] ~]# /etc/init.d/mysqld startMySQL Daemon failed to start.Starting mysqld: [FAILED]</pre>


So, what am I doing wrong?

Cheers!

Comments

  • scott.nemesscott.nemes MySQL Sage Current User Role Patron
    First make sure that the data is actually in /var/lib/mysql as intended, and if it is, make sure it is owned by MySQL. If it is not, MySQL will not start properly.

    chown -R mysql:mysql /var/lib/mysql/
  • EphemeralAttentionEphemeralAttention Entrant Inactive User Role Beginner
    Hi,

    Yes I forgot to reply. I noticed the files were owned by root so I chown'd them and it starts now.

    /var/lib/mysql is the data directory; however, I setup a symbolic link to /mnt/raid/mysql. Could this be the reason why the script didn't do it? Or is chown-ing part of the standard recovery procedure?
Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.