Restoring MySQL databases...

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
jbennett
Posts: 522
Joined: Mon Apr 16, 2012 3:00 pm

Restoring MySQL databases...

Post 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?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Restoring MySQL databases...

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
jbennett
Posts: 522
Joined: Mon Apr 16, 2012 3:00 pm

Re: Restoring MySQL databases...

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Restoring MySQL databases...

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
jbennett
Posts: 522
Joined: Mon Apr 16, 2012 3:00 pm

Re: Restoring MySQL databases...

Post 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.
jbennett
Posts: 522
Joined: Mon Apr 16, 2012 3:00 pm

Re: Restoring MySQL databases...

Post 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?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Restoring MySQL databases...

Post 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?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
jbennett
Posts: 522
Joined: Mon Apr 16, 2012 3:00 pm

Re: Restoring MySQL databases...

Post 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)?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Restoring MySQL databases...

Post 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.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
jbennett
Posts: 522
Joined: Mon Apr 16, 2012 3:00 pm

Re: Restoring MySQL databases...

Post 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?
Locked