Page 1 of 1

Can't insert event

Posted: Wed Sep 29, 2004 1:53 pm
by hemabe
Hello,

after a reboot, zoneminder did not record any events anymore. I found this in the logs:

Sep 29 15:37:39 linux zma-m2[6720]: INF [Tresen: 029 - Gone into alarm state]
Sep 29 15:37:39 linux zma-m2[6720]: ERR [Can't insert event: Duplicate entry '38689' for key 1]

I had this problem once before. At that time I deleted all entries in the database, but there must be a different solution for this problem, or?

Greetings from germany,

Hermi

Posted: Thu Sep 30, 2004 3:01 am
by marmoset
It sounds like your database has crashed and now has inconsistancies in it.

You'll want to shut down your database cleanly with either:

mysqladmin -u root -p shutdown

or if you can't do that for some reason:

kill -TERM <pid of mysql>

and if that still doesn't cause it to stop (corruption sometimes causes mysql to not die as it should), then:

kill -KILL <pid of mysql>

Now that mysql isn't running, you need to go into the directory that contains your database files, perhaps /var/lib/mysql/zm or wherever your distribution keeps them, and do:

myisamchk -o *.MYI

this will rebuild the indexes to all your tables.

Now start up mysqld again (/etc/init.d/mysql start or whatever) and you should be good to go.

Posted: Thu Sep 30, 2004 6:47 pm
by zoneminder
mysqlcheck should work as well and you don't need to shut down the database to use it.

Phil,

Posted: Thu Sep 30, 2004 8:43 pm
by hemabe
marmoset wrote: myisamchk -o *.MYI

this will rebuild the indexes to all your tables.
Thank you for your hint. I had to do a "myisamck -r *.MYI" to get rid of the problem.

greetings,

Hermi

Posted: Tue Oct 05, 2004 4:30 pm
by fernando
mysqlcheck is similar in function to myisamchk, but works differently. The main operational difference is that mysqlcheck must be used when the mysqld server is running, whereas myisamchk should be used when it is not. The benefit of using mysqlcheck is that you do not have to stop the server to check or repair your tables.


from http://dev.mysql.com/doc/mysql/en/Using_mysqlcheck.html