Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm running Centos 5.7. I'm running Apache, MySQL, PHP, Courier-IMAP, Qmail and Plesk control panel in a typical Web hosting server setup. It gets hung often.

I had to restart the server via the admin panel, since there was no Plesk or SSH access... How to prevent this from happening again?

Processor: AMD Phenom(tm) II X4
RAM: 8 GB

I noticed some errors in the Apache log:

# tail -20 /var/log/httpd/error_log

[Mon Sep 03 06:12:33 2012] [error] [client 202.29.34.28] File does not exist: /var/www/vhosts/default/htdocs/web
[Mon Sep 03 06:12:34 2012] [error] [client 202.29.34.28] File does not exist: /var/www/vhosts/default/htdocs/php-my-admin
[Mon Sep 03 06:12:34 2012] [error] [client 202.29.34.28] File does not exist: /var/www/vhosts/default/htdocs/websql
[Mon Sep 03 06:12:35 2012] [error] [client 202.29.34.28] File does not exist: /var/www/vhosts/default/htdocs/phpmyadmin
[Mon Sep 03 06:12:36 2012] [error] [client 202.29.34.28] File does not exist: /var/www/vhosts/default/htdocs/phpMyAdmin
[Mon Sep 03 06:12:36 2012] [error] [client 202.29.34.28] File does not exist: /var/www/vhosts/default/htdocs/phpMyAdmin-2
[Mon Sep 03 06:12:37 2012] [error] [client 202.29.34.28] File does not exist: /var/www/vhosts/default/htdocs/php-my-admin
[Mon Sep 03 06:12:38 2012] [error] [client 202.29.34.28] File does not exist: /var/www/vhosts/default/htdocs/phpMyAdmin-2.2.3
[Mon Sep 03 06:12:38 2012] [error] [client 202.29.34.28] File does not exist: /var/www/vhosts/default/htdocs/phpMyAdmin-2.2.6
[Mon Sep 03 06:12:39 2012] [error] [client 202.29.34.28] File does not exist: /var/www/vhosts/default/htdocs/phpMyAdmin-2.5.1
[Mon Sep 03 06:12:39 2012] [error] [client 202.29.34.28] File does not exist: /var/www/vhosts/default/htdocs/phpMyAdmin-2.5.4
[Mon Sep 03 06:12:40 2012] [error] [client 202.29.34.28] File does not exist: /var/www/vhosts/default/htdocs/phpMyAdmin-2.5.5-rc1
[Mon Sep 03 06:12:41 2012] [error] [client 202.29.34.28] File does not exist: /var/www/vhosts/default/htdocs/phpMyAdmin-2.5.5-rc2
[Mon Sep 03 06:12:41 2012] [error] [client 202.29.34.28] File does not exist: /var/www/vhosts/default/htdocs/phpMyAdmin-2.5.5
[Mon Sep 03 06:12:42 2012] [error] [client 202.29.34.28] File does not exist: /var/www/vhosts/default/htdocs/phpMyAdmin-2.5.5-pl1
[Mon Sep 03 06:12:43 2012] [error] [client 202.29.34.28] File does not exist: /var/www/vhosts/default/htdocs/phpMyAdmin-2.5.6-rc1
[Mon Sep 03 06:12:43 2012] [error] [client 202.29.34.28] File does not exist: /var/www/vhosts/default/htdocs/phpMyAdmin-2.5.6-rc2
[Mon Sep 03 06:12:44 2012] [error] [client 202.29.34.28] File does not exist: /var/www/vhosts/default/htdocs/phpMyAdmin-2.5.6
[Mon Sep 03 06:12:45 2012] [error] [client 202.29.34.28] File does not exist: /var/www/vhosts/default/htdocs/phpMyAdmin-2.5.7
[Mon Sep 03 06:12:45 2012] [error] [client 202.29.34.28] File does not exist: /var/www/vhosts/default/htdocs/phpMyAdmin-2.5.7-pl1

Also noticed some mysql slow queries:

# Query_time: 23.734215  Lock_time: 0.000111 Rows_sent: 1  Rows_examined: 2501281
use yasooyam_yasoodb;
SET timestamp=1346149823;
SELECT COUNT(user_history_product.ID) FROM user_history_product WHERE user_history_product.PRODUCT_ID=915;

# Query_time: 293.916966  Lock_time: 1.163037 Rows_sent: 1  Rows_examined: 2501280
SET timestamp=1346149823;
SELECT COUNT(user_history_product.ID) FROM user_history_product WHERE user_history_product.PRODUCT_ID=172;

# Query_time: 61.295134  Lock_time: 0.000345 Rows_sent: 331  Rows_examined: 331
use pumexinf_mdb;
SET timestamp=1346149825;
show tables;

# Query_time: 16.869923  Lock_time: 2.281526 Rows_sent: 1889  Rows_examined: 9330
use yasooyam_yasoodb;
SET timestamp=1346586973;
SELECT user_items.ID, user_items.TYPE, user_items.USER_ID, user_items.SHOW_IN, user_items.CATEGORY, user_items.SUB_CATEGORY, user_items.COUNTRY, user_items.LANGUAGE, user_items.TITLE, user_items.START_TIME, user_items.END_TIME, user_items.DATE, user_items.DESCRIPTION, user_items.ATTACH, user_items.IMAGE, user_items.IMAGE_AUTHOR, user_items.IMAGE_SOURCE, user_items.VIDEO_URL, user_items.THUMB, user_items.AUTHOR, user_items.SOURCE, user_items.CREATE_DATE, user_items.UPDATE_DATE, user_items.STATUS FROM user_items WHERE user_items.TYPE=9 AND user_items.STATUS=1;
share|improve this question
    
None of those log entries are directly relevant to your problem, although the MySQL query times are indicative of some process tying up the CPU. The Apache log entries should be self explanatory, you only need to read them. –  John Gardeniers Sep 3 '12 at 12:51

2 Answers 2

Try to install a monitoring software like Munin. With munins plugins, you can monitor a lot of things over time. For example you can see a spike in Apache requests before the server hangs, or disk I/O, or mysql connections. With such a software in place, it is much easier to find the source for hangups.

share|improve this answer
    
which monitoring software is easier to use for a beginner? –  melvincv Sep 3 '12 at 11:20
    
I generally prefer munin. There are a lot of predefined plugins available already, and there are normally packages available for your linux distribution. –  j0nes Sep 3 '12 at 11:50
    
I'm installing Munin using howtoforge.com/… –  melvincv Sep 3 '12 at 13:01
    
I've been running Munin for almost 1 day, but I can only see dots in the graph... no real graphs. And please point me to a link to get plugins. –  melvincv Sep 4 '12 at 10:21
    
For some linux distributions there are already packages with plugins available. Otherwise have a look at the munin contrib github repository –  j0nes Sep 4 '12 at 10:29

Hang is surely not the result of a fatal error of (file not found) - as per apache2 logs.

It depends on how much memory you have allowed in your my.cnf for mysqld.

You need to investigate a bit more about why this is hanging.

Few things to note for investigation:

  • Server hanging(denial of service) can be result of 2 things, over-processor load or an application causing denial of service.
  • Check system log instead of application logs for more insights
  • Have precautionary measures by installing deflateDOS and SELinux Check their logs
  • Keep in mind commands like top and netstat they come in handy a lot.
share|improve this answer
    
there is no my.ini. There is my.cnf. I'm a junior linux admin, please explain at the basic level. :) –  melvincv Sep 3 '12 at 11:08
    
yea, edited it :P I am not even an admin, I am just a developer frowns –  KarmicDice Sep 3 '12 at 11:40
    
query_cache_size=128M –  melvincv Sep 3 '12 at 11:48
    
I thought admins have the inferiority complex... including me. –  melvincv Sep 3 '12 at 11:49
    
We thought we look like an idiot when we call admin to fix an installation which required 'sudo' in the beginning of command. :S –  KarmicDice Sep 3 '12 at 11:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.