Page 1 of 2
Restore of database - Database error
Posted: Fri Jul 31, 2020 7:31 am
by mccrakem
Hi
I'm moving Nagiosxi to a new CentOS7 Server
I have migrated 6 systems so far and all have went well apart from this last one
I install Nagiosxi 5.6.14
I access the URL and all looks fine I can login with the nagiosadmin user as its the default database there is no hosts
I restore from a backup I took this morning backup is approx 5.7GB
I run the tarball as we are moving from RHEL6 to CentOS7
when the tarball is complete I just get the error
Database Error
Screen shot attached
I run the command
/usr/local/nagiosxi/scripts/repair_database.sh
seems to complete without issues
only this is when its complete it only lists 2 database does not mention the nagiosxi database
Screenshot attached
So I tried to run the repairmysql.sh nagiosxi but nothing happens
Screenshot attached
Re: Restore of database - Database error
Posted: Fri Jul 31, 2020 1:01 pm
by lmiltchev
Was your "old" system using postgres? Maybe nagiosxi db is there. What is the output of the command below?
Code: Select all
echo '\d' | psql nagiosxi nagiosxi
Re: Restore of database - Database error
Posted: Tue Aug 04, 2020 2:32 am
by mccrakem
Hi Here are the screenshots from the provided command on both Nagios system
Current and New
Re: Restore of database - Database error
Posted: Tue Aug 04, 2020 9:59 am
by lmiltchev
OK, so I was correct about postgres being used on your old system. This shouldn't be a problem though. Are you still seeing db errors? What is the actual issue that you are currently having?
Re: Restore of database - Database error
Posted: Tue Aug 04, 2020 10:44 am
by mccrakem
Hi
When I start the server (it is currently off at the moment and the original server is still running RHEL6)
All I get is the Database Error shown in the screenshot
and when I try and repair the database nothing happens it says Repair Complete but all I see if that message no login screen nothing just that message
Thanks
Re: Restore of database - Database error
Posted: Tue Aug 04, 2020 11:52 am
by lmiltchev
Is postgreql running on the new server? Run the following commands, and show the output:
Code: Select all
service postgresql restart
service postgresql status
Also, you are changing the OS version, so I wonder - have you tried running the "restore_repair.sh" script as described on page 13 in the document below?
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
If you haven't, try running it to see if this is going to fix your issue.
Re: Restore of database - Database error
Posted: Wed Aug 05, 2020 4:31 am
by mccrakem
Hi
I had run the restore_repair.sh script
But this morning what I did was removed Nagiosxi and did a complete new install and then tested another Database restore
I got the same issue, so I am working if this is a corrupted backup
I will see if i can run another backup and run the restore with the new backup
I have attached a screenshot of the postgresql status
I have attached a copy of the restore text
I found the following which is very similar to the issue I am seeing
https://support.nagios.com/forum/viewto ... 6&start=10
Commands
echo "vacuum;vacuum analyse;vacuum full;"|psql nagiosxi postgres
echo "vacuum;vacuum analyse;vacuum full;"|psql postgres postgres
echo "vacuum;vacuum analyse;vacuum full;"|psql template1 postgres
Output
echo "vacuum;vacuum analyse;vacuum full;"|psql nagiosxi postgres
VACUUM
VACUUM
VACUUM
echo "vacuum;vacuum analyse;vacuum full;"|psql postgres postgres
VACUUM
VACUUM
VACUUM
echo "vacuum;vacuum analyse;vacuum full;"|psql template1 postgres
VACUUM
VACUUM
VACUUM
Re: Restore of database - Database error
Posted: Wed Aug 05, 2020 2:06 pm
by lmiltchev
How much space do you have on the new server?
Have you checked both logs (postgres and mysql) for errors?
The postgres logs should be located in the "/var/lib/pgsql/data/pg_log" directory. You can use tail to view the most recent log, e.g.:
Code: Select all
tail -100 /var/lib/pgsql/data/pg_log/postgresql-Wed.log
For mysql logs, you could run this:
or this:
Code: Select all
tail -100 /var/log/mariadb/mariadb.log
depending on whether you are using mysql or mariadb.
Re: Restore of database - Database error
Posted: Wed Aug 05, 2020 3:59 pm
by mccrakem
Hi
Find attached the output from the above commands
Can you take a look and see if anything stands out to you
Thanks
Re: Restore of database - Database error
Posted: Wed Aug 05, 2020 4:52 pm
by lmiltchev
When you run the repair on the db (mysql), according to your screenshot:
example-01.jpg
nagiosxi db is not present in mysql. Only
nagios and
nagiosql databases are repaired. Since you are restoring from an old system, nagiosxi db must be in postgres. But looking at your postgres log, I see this:
FATAL: database "nagiosxi" does not exist
Are you sure your backup is not corrupted? Can you find the nagiosxi db in the backup tarball? Is it in postgres or mysql?