MySQL Quota Daemon<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

1 About

MySQL Quota Daemon is a lightweight tool for limiting database sizes. As the MySQL server has no support for preventing disk from ge<?xml:namespace prefix = st1 ns = "Tencent" />tting filled up, an external one is needed. Other solutions are often bloated or to 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.

“MySQL 限额守护进程 是一个用来限制数据库大小的轻量级工具。由于 MySQL 不支持磁盘空间的限制,所以需要外部的工具来实现。

 

2 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.

1.      为每个数据库建立配额限制

2.      当超过限额,数据库的创建和插入权限将被取消,更新的权

3.      保留当数据库被清理到低于限制,权限将被自动恢复

 

3 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.

这个守护进程依赖于:

Perl5 Perl 的一些基本模块,包括 DBI DBD::mysql

MySQL 4 或更高版本

前端依赖于:

Apache CGI 或其他相兼容的

Perl 模块 HTML::Template

 

4 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 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 [url]http://yourdomain.com/cgi-bin/mysqlquota.cgi[/url] (of course substitute the domain to whatever it should be).

这个包带有一个安装脚本。用 “tar -zxf mysql_quota.tar.gz” 解压缩后,运行 “Perl install.pl” ,然后回复所有提示。假设把前端直接放在 cgi-bin 目录下,这样就可以通过访问 [url]http://yourdomain.com/cgi-bin/mysqlquota.cgi[/url] 来管理

 

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.

在运行时,守护进程会在安装时指定的路径中搜索其配置文件,在 ~/.mysqlquotadrc /etc/mysql_quota ;也可以仅指定其它的文件作为参数;否则它将无参数启动。假设把可执行文件安装在 /usr/local/bin ,可以添加 /usr/local/bin/mysqlquotad /etc/rc.d/rc.local 文件,或诸如此类地它将运行在系统上。这样,守护进程将在启动时自动运行。