Sysadmining made easier? MySQL constantly crashing, etc

I'm new to this whole sysadmin thing and really struggle with the basics. I can't seem to keep the database running on a single instance of wordpress. I've tried reviewing logs and such but can't seem to figure out anything going wrong. At this point, I don't care to figure it out. I just want the service to reboot automatically if it goes down. How do the big hosting companies handle this (e.g., dreamhost)? Do they have scripts that run and check status on mysql frequently? If so, any examples? Do any other tools exists that could help manage some of the sysadmin "burden"?

Thanks!

6 Replies

@austins:

I don't care to figure it out.

[…]

How do the big hosting companies handle this (e.g., dreamhost)?

[…]
The big hosting companies do care about figuring it out.

Your mysql daemon is probably a victim of the Out Of Memory killer. I guess you have Apache in prefork mode and more visits than your available RAM + swap can handle.

Consider switching to Nginx + PHP-FPM.

p.s. If you want to be a good sysadmin, you should really abandon the idea (common among users of Windows) that rebooting is the way to solve your problems.

@austins:

How do the big hosting companies handle this (e.g., dreamhost)? […]

Most major companies don't look to reboots to fix most issues, they look at fixing the issue that is causing it to die or reboot in the first place.

But in direct answer to your questions, most large web-hosting companies have teams that monitor all their Servers health via Nagios, or in-house monitoring software. When a service dies, it alerts them and they can look into the root cause.

You need proper monitoring to make sure server is up and running

Try this command you can see if mysql got killed because of memory shortage

cat /var/log/messages | grep mysql | grep oom

@iserversupport:

You need proper monitoring to make sure server is up and running

Try this command you can see if mysql got killed because of memory shortage

cat /var/log/messages | grep mysql | grep oom

1. /var/log/messages is the syslog for RedHat/CentOS distributions. Other distros will differ.

2. cat /var/log/messages | grep mysql is an unnecessary use of 'cat'.

If you're really a Linux server administrator you should know these things.

austins: if you really don't care to figure it out (as you said), then we can't help. You should be using a managed web hosting service.

I think I was just in a bad mood when I posted. I actually do enjoy the learning aspects, but it is tiring when I'm not a diehard linux guy and can't figure something out. I'm taking everything you all said into consideration. It does appear that mysql is dieing because of a memory error:

mysqld invoked oom-killer: gfpmask=0x280da, order=0, oomscore_adj=0

I guess time to do some research. I only have a single wordpress site that I'd like to keep running on the regular. It is getting about 500 hits a day…

@austins:

mysqld invoked oom-killer: gfpmask=0x280da, order=0, oomscore_adj=0

Sounds like sanvila's crystal ball is working well.
@sanvila:

Your mysql daemon is probably a victim of the Out Of Memory killer. I guess you have Apache in prefork mode and more visits than your available RAM + swap can handle.

Are you running Apache? If so, check out the Linode memory troubleshooting guide. Should you still have out-of-memory problems after following that, reduce MaxClients even lower. As suggested earlier, you could also switch to nginx or use Apache with php-fpm, but these are more involved options that aren't really necessary for a low-traffic blog.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct