1.About
MySQL Quota Daemon is a lightweight tool for limiting database sizes. As the MySQL server has no support for preventing disk from gett ing 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.
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]htt p://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文件,或諸如此類地它將運行在系統上。這樣,守護進程將在啓動時自動運行。