Introduction
If we check the Apache
error logs, we could see httpd getting restarted gracefully every two
hours. During this time some users experinces a slight slowness of
their website. The reason the restarts occur is that Apache must be
restarted to grab the new logs file handles. If Apache were not
restarted, bandwidth/stats would fail to log and that data be lost.
# grep Graceful
/usr/local/apache/logs/error_log
[Tue Aug 25 14:14:22
2015] [notice] Graceful restart requested, doing restart
[Tue Aug 25 19:15:03
2015] [notice] Graceful restart requested, doing restart
[Wed Aug 26 00:57:45
2015] [notice] Graceful restart requested, doing restart
[Wed Aug 26 01:47:50
2015] [notice] Graceful restart requested, doing restart
[Wed Aug 26 02:37:54
2015] [notice] Graceful restart requested, doing restart
[Wed Aug 26 11:07:03
2015] [notice] Graceful restart requested, doing restart
This can be fixed by
enabling piped Apache logs. Piped Apache logs reduce the number of
open file handles on a server and eliminate the need for Apache to be
restarted during stats/bandwidth logging
Requirment
We require root access
to the server in order to implement piped logging.
Steps.
There are two possibel
methods to enable piped logging. This can be done either by command
line terminal or from WHM interface.
Step1: Command line
Login as root via SSH
Make a backup of the
Apache configuration file
cp -rp
/usr/local/apache/conf/httpd.conf
/usr/local/apache/conf/httpd.conf_backpiped
Edit
/var/cpanel/cpanel.config:
vi
/var/cpanel/cpanel.config
Make effect the changes
in cpanel configuration. Run following command
/usr/local/cpanel/whostmgr/bin/whostmgr2
--updatetweaksettings
Rebuild the Apache
config:
/scripts/rebuildhttpdconf
Stop and Start Apache:
/etc/init.d/httpd stop
/etc/init.d/httpd start
Step2: From WHM
interface
Make a backup of the
Apache configuration file
cp -rp
/usr/local/apache/conf/httpd.conf
/usr/local/apache/conf/httpd.conf_backpiped
Login to WHM
Go to WHM » Service
Configuration » Apache Configuration » Piped Log Configuration
Check the box labeled
Enable piped Apache logs.
Thats all!!
No comments:
Post a Comment