Page 1 of 1

Mysqld errors even after a repair

Posted: Mon Nov 16, 2015 2:32 pm
by JakeHatMacys
Been getting this all morning and a /usr/local/nagiosxi/scripts/repairmysql.sh nagios repair isn't fixing it...

Code: Select all

151116 14:29:25 [ERROR] /usr/libexec/mysqld: Table './nagios/nagios_logentries' is marked as crashed and last (automatic?) repair failed
151116 14:29:25 [ERROR] /usr/libexec/mysqld: Table './nagios/nagios_logentries' is marked as crashed and last (automatic?) repair failed
151116 14:29:25 [ERROR] /usr/libexec/mysqld: Table './nagios/nagios_logentries' is marked as crashed and last (automatic?) repair failed
151116 14:29:25 [ERROR] /usr/libexec/mysqld: Table './nagios/nagios_logentries' is marked as crashed and last (automatic?) repair failed
151116 14:29:28 [ERROR] /usr/libexec/mysqld: Table './nagios/nagios_logentries' is marked as crashed and last (automatic?) repair failed
During my first repair I Did see this:

myisamchk: error: myisam_sort_buffer_size is too small
MyISAM-table 'nagios_logentries.MYI' is not fixed because of errors
Try fixing it by using the --safe-recover (-o), the --force (-f) option or by not using the --quick (-q) flag


But have no idea what that means. Any ideas????

Re: Mysqld errors even after a repair

Posted: Mon Nov 16, 2015 2:42 pm
by tgriep
The logentries table can get quite large and the sort buffer size needs to be increased to repair it.
Run the following as root on the XI server to repair the database

Code: Select all

service mysqld stop
cd /var/lib/mysql/nagios
myisamchk -r -f * --sort_buffer_size=2G
service mysqld start
rm -f /usr/local/nagiosxi/var/dbmaint.lock
php /usr/local/nagiosxi/cron/dbmaint.php
If you still get the buffer size too small, try increasing the to --sort_buffer_size=3G and run the repair above again.

Re: Mysqld errors even after a repair

Posted: Mon Nov 16, 2015 3:32 pm
by JakeHatMacys
Looks like that got her done.

Thx!

Should I alter the mysqld repair script to account for this???? If so could you help out with that??? O.o

Re: Mysqld errors even after a repair

Posted: Mon Nov 16, 2015 4:01 pm
by tgriep
This is the file you can edit to add that option to the myisamchk command

Code: Select all

/usr/local/nagiosxi/scripts/repairmysql.sh
Search for this line and add the buffer size that you used to repair the table

Code: Select all

cmd="/usr/bin/myisamchk -r -f"