Page 1 of 2

Restoring MySQL databases...

Posted: Mon Jul 16, 2012 11:12 am
by jbennett
I am trying to run a restore to a different box, but I'm running into an issue.

The process seems to hang at the MySQL database restore. It has been sitting at this screen for the past 2+ hours.

I can run a ps ax and see that the restore_xi.sh process is still running.

Is there anything else I can check to verify that the restore is actually still occurring or do I have any other options?

Are there any limits to how big the DB can be for the restore to work correctly?

Re: Restoring MySQL databases...

Posted: Mon Jul 16, 2012 11:26 am
by lmiltchev
I am not aware of any limits to the size of the DB in order for the restore to work correctly. Do you have enough disk space?

Code: Select all

df -h

Re: Restoring MySQL databases...

Posted: Mon Jul 16, 2012 1:30 pm
by jbennett

Code: Select all

Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/os_vg-root_lv
                       16G   12G  2.7G  82% /
/dev/mapper/os_vg-tmp_lv
                      4.8G  273M  4.3G   6% /tmp
/dev/mapper/os_vg-home_lv
                      2.9G   69M  2.7G   3% /home
/dev/mapper/os_vg-usr_lv
                       20G  9.9G  9.1G  53% /usr
/dev/mapper/os_vg-var_lv
                      7.5G  5.7G  1.4G  81% /var
/dev/hda1             996M   62M  883M   7% /boot
tmpfs                 4.0G     0  4.0G   0% /dev/shm
10.100.3.220:/kickstart
                      190G  103G   77G  58% /kickstart
It appears that I have plenty of space left currently.

Re: Restoring MySQL databases...

Posted: Mon Jul 16, 2012 1:45 pm
by scottwilkerson
What is the last item displayed on the screen?

Sometimes if you have a short logout windows it can close the ssh connection before it completes

Re: Restoring MySQL databases...

Posted: Mon Jul 16, 2012 1:48 pm
by jbennett

Code: Select all

In /store/backups/nagiosxi/1342450470-restore/1339567203...
Backup files look okay.  Preparing to restore...
Shutting down services...
Configuration file /usr/local/nagios/etc/nagios.cfg not found.  Exiting.
Configuration file /usr/local/nagios/etc/ndo2db.cfg not found.  Exiting.
NPCD was not running.
Restoring directories to /...
Restoring Nagios Core...
Restoring Nagios XI...
Restoring NagiosQL...
Restoring NagiosQL backups...
Restoring MySQL databases...
I'm connected via PuTTy and was able to open another session successfully.

Re: Restoring MySQL databases...

Posted: Mon Jul 16, 2012 3:30 pm
by jbennett
After 5+ hours of waiting for this command to complete, I CTRL+C'd out of it. Upon doing so, I received the following:

Code: Select all

ERROR 3 (HY000) at line 5211: Error writing file '/tmp/ST1J38sB' (Errcode: 28)
Error restoring MySQL database 'nagios' - check the password in the script!
I can log into the database just fine using the standard password, the same as is directed in the script. Once I'm in, I can query: show databases; and I'm shown the following (which seems to be accurate):

information_schema
mysql
nagios
nagiosql
test

I'm not sure I understand why it's throwing this error when the password apparently works? Is there something else going on here?

Re: Restoring MySQL databases...

Posted: Mon Jul 16, 2012 3:32 pm
by scottwilkerson
Can you run the following to see if you are getting errors

Code: Select all

tail -f /var/log/mysqld.log
I have a feeling that it could be related to space as your partition that holds the database is the one that is 81% full and you will need enough to hold the new database.

Do you still have the old database in there?

Re: Restoring MySQL databases...

Posted: Mon Jul 16, 2012 4:14 pm
by jbennett
This was initially a clean install. I'm guessing that after trying to run the restore again, it doesn't overwrite the database, it just adds to it?

I just checked it again and now it's at 100% full. unfortunately, I cannot get exact space requirements for the DB that the backups were created from since the system is down. is there any way to know for sure otherwise?

What would be the best way to go about clearing out the data? Is some data created during the initial install process that would be missing if I dropped the table and just recreated it (nagios)?

Re: Restoring MySQL databases...

Posted: Tue Jul 17, 2012 7:56 am
by scottwilkerson
There is no way to really determine the size of the full database, However I would suggest going a quite a bit larger than the 7.5GB you had for /var

There is some data that is put in the DB at install but the bulk of the data is going to be in your restore.

You could truncate large tables in the nagios db, but you would still need to restore the nagiosql database which hasn't been loaded at this point.

Re: Restoring MySQL databases...

Posted: Tue Jul 17, 2012 9:10 am
by jbennett

Code: Select all

 df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/os_vg-root_lv
                       16G   16G     0 100% /
/dev/mapper/os_vg-tmp_lv
                      4.8G  273M  4.3G   6% /tmp
/dev/mapper/os_vg-home_lv
                      2.9G   69M  2.7G   3% /home
/dev/mapper/os_vg-usr_lv
                       20G  9.9G  9.1G  53% /usr
/dev/mapper/os_vg-var_lv
                      7.5G  4.5G  2.6G  64% /var
/dev/hda1             996M   62M  883M   7% /boot
tmpfs                 4.0G     0  4.0G   0% /dev/shm
10.100.3.220:/kickstart
                      190G  103G   77G  58% /kickstart
Can you give me an idea of how much space is necessary? I know that this will all depend on the size of your implementation.

Also, am I safe to drop the data in the tables completely then try the restore again? I'm not going to be dropping anything else that might have been created as part of the install process, correct?