Michael Alger wrote:
On Thu, Aug 21, 2008 at 05:13:22PM +0200, Chris Joelly wrote:
On Thu, Aug 21, 2008 at 11:59:15AM +0200, Andrew Beekhof wrote:
On Aug 21, 2008, at 1:01 AM, Chris Joelly wrote:
i have a question on handling logrotate with services which are
managed using heartbeat / crm:

if e.g. apache is startet/stopped using the resource manager,
and logrotate restarts it when logrotate rotates the apache
logfiles, how would crm respond to this issue? is crm able to
handle thios correct or
is crm seeing a resource failure and then not be able to start
apache again as it is stopped and then restartet outside of crm?
Its entirely up to the apache resource agent.
If it reports the apache failed, then we'll restart it.
ok, i see i messed things up...
but what is the best practice to handle logrotate triggered
restarts of services (e.g. apache) which forces the cluster
software to restart the service using the resource agent?

is the way to go to use some sort of database logging (using
mod_log_sql for apache) or for other services use syslog-ng with
output to databases and disabling logrotate on this services?

or is there another way staying with the textfile based logging?

Quite intriguing. Most services don't require a restart in order to
rotate logs. However, having done a bit of a quick search, it appears
this likely is the case for Apache 1.x. It looks like a common solution
is to have Apache write its logs via a separate process which handles
rotation without having to restart the server:

  http://httpd.apache.org/docs/1.3/programs/rotatelogs.html

This may contain some useful information as well:

  http://www.freebsddiary.org/rotatelogs.php


We've tended to configure Apache to log to /some/where/access.log and /some/where/error.log with those being symlinks to /some/where/access_log.YYMM and /some/where/error_log.YYMM respectively. A script is then run at 00:00 on the 1st of each month which stops Apache, removes the symlink, creates new empty access_log.YYMM and error_log.YYMM files, re-creates the symlink then restarts Apache.

What I haven't done (yet) is implement the same on a heartbeat cluster. I'm planning to achieve this (see the thread "use of crm_resource" 15 Jul - 18 July) by having the script issue the command

crm_resource -r Apache --meta -p target_role -v stopped

before switching the log files over then

crm_resource -r Apache --meta -p target_role -v started

afterwards.

--
Paul Walsh

_______________________________________________
Linux-HA mailing list
[email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems

Reply via email to