MySQL Quota Daemon
MySQL Quota Daemon is a lightweight tool for limiting database sizes. As the MySQL server has no support for preventing disk from getting filled up, an external one is needed. Other solutions are often bloated or too obscure to use. This one keeps low profile, being both nice to the system it runs on and easy to use. A basic front end for simple management and informing of any quota violation is included.
How does it work
First, you have to set up quota limits for individual databases. Then, whenever any of these limits is violated, the CREATE and INSERT privileges are taken from that database. It can be also set up to take the UPDATE privilege. When the database has been trimmed to fit the limits, the privileges are automatically GRANTed back.
Dependencies
The Quota Daemon depends on:
- Perl 5 with basic modules, including DBI and DBD::mysql.
- MySQL 4 or higher.
Furthermore the front end depends on:
- Apache and CGI or compatible.
- HTML::Template Perl module. Now a lite version available without templating.
The installer assumes it’s run on some kind of UN*X system.
Installation and configuration
The package comes with an installer. After unpacking it with
tar -zxf mysql_quota.tar.gz
you should run
Perl install.pl
and reply to all the following questions. Then, assuming you put the front end directly in you root cgi-bin directory, you can administer it by your browser visiting
http://yourdomain.com/cgi-bin/mysqlquota.cgi
(of course substitute the domain to whatever it should be).
The daemon, at runtime,
will search for it’s configuration file in the path specified at install
time and at: ~/.mysqlquotadrc
or /etc/mysql_quota
.
Alternatively,
you can specify other file as the only parameter.
Otherwise,
it should be started without parameters.
Assuming you installed the executable with
standard name at /usr/local/bin/
you can add the line:
/usr/local/bin/mysqlquotad
to your /etc/rc.d/rc.local
file,
or whatever it should be under your system.
And voila - the daemon starts automatically at boot time.
Lite version
Lite version is essentially the normal version without HTML::Template support. It simply doesn’t require you to install the module. On the other hand, it means losing the ability to freely customize the look of the front end.
Development state
v.0.5.01 - beta testing
The daemon code seems complete and has no apparent bugs. No further features are to be added, yet some additional front end templates or a php front end are possible. Also, some further work on installer or distribution native packages are planned. If you find any bugs or gain any insights by using this software, you are welcome to mail me.
License
MySQL Quota Daemon is distributed under the terms of GNU General Public License (GPL), which can be found at http://www.gnu.org/copyleft/gpl.html. Additionally you are encouraged to mail me any feedback about my software.