Problem with one black out

Support and queries relating to all previous versions of ZoneMinder
Locked
julianopillati
Posts: 15
Joined: Tue May 31, 2005 10:30 pm
Contact:

Problem with one black out

Post by julianopillati »

Hello, I was my Zm working ok, but one blackout(energy out) reset mahine with ZM, them when machine come back I have this message :
Can't open file: 'Events.MYI'. (errno: 145)
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /var/www/svd/zm_html_view_console.php on line 72

With this message ZM not show my events, the cameras are working, i can login in ZM but i have this messages and my old events not exist more and not have new events. Anyone ideia what is this and how resolv ?

Thank you.
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

The database has errors and needs repair. Try this

mysqlcheck --all-databases --auto-repair -u root -p

That should take care of your problem.
Regards,
Cordel
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

i have been searching for that as i forgot the command. you beat me to it cordel lol

James
julianopillati
Posts: 15
Joined: Tue May 31, 2005 10:30 pm
Contact:

Working now!!

Post by julianopillati »

Thank you cordeal and ameswilson, I stop ZM and do this :
postomacan:~# mysqlcheck --all-databases --auto-repair -u root -p
Enter password:
mysql.columns_priv OK
mysql.db OK
mysql.func OK
mysql.host OK
mysql.tables_priv OK
mysql.user OK
zm.Config OK
zm.Controls OK
zm.Events
warning : Table is marked as crashed
warning : 1 client is using or hasn't closed the table properly
warning : Size of datafile is: 1336376 Should be: 1336300
error : Record-count is not ok; is 17050 Should be: 17049
warning : Found 22237 parts Should be: 22236 parts
error : Corrupt
zm.Filters OK
zm.Frames
warning : Table is marked as crashed
warning : 1 client is using or hasn't closed the table properly
warning : Size of datafile is: 33955710 Should be: 33955230
error : Found 1131857 keys of 1131841
error : Corrupt
zm.Groups OK
zm.Monitors OK
zm.States OK
zm.Stats
warning : Table is marked as crashed
warning : 1 client is using or hasn't closed the table properly
warning : Size of datafile is: 32506551 Should be: 32506257
error : Found 663399 keys of 663393
error : Corrupt
zm.TriggersX10 OK
zm.Users OK
zm.Zones OK

Repairing tables
zm.Events
warning : Number of rows changed from 17049 to 17050
status : OK
zm.Frames
warning : Number of rows changed from 1131841 to 1131857
status : OK
zm.Stats
warning : Number of rows changed from 663393 to 663399
status : OK
postomacan:~#

After I start ZM and are working now :-)
But show somes messages as "corrumpted" but now show message about correct that corrupeted. Have anyone problem with my log above or are all right ?

Thanks,

Juliano
User avatar
victor_diago
Posts: 245
Joined: Wed Jan 21, 2004 2:44 pm
Location: Brazil, sao paulo
Contact:

Post by victor_diago »

Hi,

Mysql must be stopped

Code: Select all

mysqladmin -u root -p shutdown
(then it will ask for your password)

Try then

Code: Select all

myisamchk -rf /var/lib/mysql/zm/*.MYI

After all that, reboot the system with your install boot cd and run reiserfsck --rebuild-tree in your partition.

this should make everything back normal again
julianopillati
Posts: 15
Joined: Tue May 31, 2005 10:30 pm
Contact:

easy problem in mysql ?

Post by julianopillati »

I run reiserfs rebuildtree and File system are ok. Problem is only in mysql then...I think!

Why mysql corrupt easy with two energy out ?
This is very insecury, or I really need one nobreak ?


Thank you,


Juliano
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

if you stop any machine half way through a write you will get corruption. If power outrages are a mojor concern use a little ups on your zm box.
You could always have a cron job to do a mysql check on boot.

James
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

The best thing to do is to put mysqlcheck --all-databases --auto-repair into the mysql or zm startup script. This way if the power goes out, when it boots up the tables will be fixed.
Regards,
Cordel
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

is there any downsides to running mysqlcheck say once a week, or is the chance of curruption so rare its not worth it?

James
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

You could set it up as a weekly cron. Shouldn't hurt anything.
Locked