If Apache is going down you need to see Apache status and find out the long running request in Apache. You can use below command and kill the process if needed .
First of all you will need to enable server status page.
Enabling Apache Status Page
To enable status page you will need to edit httpd.conf file.
#vim /etc/httpd/conf/httpd.conf ExtendedStatus on <Location /server-status> SetHandler server-status Order Deny,Allow Deny from all Allow from east.example.com </Location>
Save and exit.
After edited httpd.conf file you will need to restart Apache service.
#service httpd restart
Now execute the below command to find the long running request on the server.
#links --dump 1 http://east.example.com/server-status|grep ^[0-9]|awk 'BEGIN {print "Seconds, PID, State, IP, Domain, TYPE, URL\n--"} $4 !~ /[GCRK_.]/ {print $6, $2, $4, $11, $12, $13 " " $14|"sort -n"}'
Here :
- Second : Apache process running request time
- PID : Process ID
- State : Request status
- IP : Client IP which is making request
- Domam : Virtual Host
- TYPE : Http
- URL : Requested url
You can use it as a scripts instead of typing command every-time. If you see high load on your server you can run this script.
After running script you can see the below output :
Command Output:
Seconds, PID, State, IP, Domain, TYPE, URL 0 5495 W 127.0.0.1 east.example.com GET /server-status 0 5710 W 199.27.134.187 east.example.com GET 2 5495 W 162.158.34.131 east.example.com POST 32 5710 W 10.12.146.154 east.example.com GET /train/cour/?title=fo7-external-cour&c=1&p=2 37 5710 W 10.12.146.154 east.example.com POST
Thanks:)
If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com. To become an author at LookLinux Submit Article. Stay connected to Facebook.
Leave a Comment