Introduction
The package includes script to automatically rotate and expire MySQL logfiles for all managed instances. It depends on the standard linux logrotate package (included in RHEL/OEL distributions).
Details
This script is expected to run on all cluster nodes at the same time from crontab. The script requires no parameters.
- Try to acquire a cluster-wide lock, the purpose of this is to ensure, that only one node will do the actual file rotation while other nodes just wait for it to complete.
- If lock was acquired, the script will look into all managed instance log directories and will write a linux logrotate configuration file dynamically and execute logrotate using generated configuration file.
- If lock was not acquired, then wait until the lock is released by another node and then continue with flushing.
- And finally, after log files have been rotated, all nodes will execute mysqladmin flush-logs on all managed instances.