MySQL Governor v0.6
[beta 0.6]
MySQL governor is set of utilities to monitor and restrict MySQL usage in shared hosting environment. The monitoring is done via USER_STATISTICS table that is available in CloudLinux version of MySQL as well as via tracking of slow queries. The table is made available by userstats patch originally developed by Google.
Getting Started
MySQL Governor tracks MySQL usage on per customer bases for 17 different limits. Once user goes over those limits, MySQL Governor will limit that user from accessing MySQL for some short period of time. After such time out passes, user access will be restored. If user repeatedly abuses MySQL his access will be terminated for longer & longer periods of time. The limits can be adjusted via configuration file.
The default values were selected in such fashion so they wouldn't cause any issues for typical installation. Yet, you might need to tune up those values. By default, MySQL governor has training log enabled, as well as error log in debug mode. You can check training log values, to see what your typical "highest" values are., and use them as limits (we recommend to multiply highest value while server still operates fine by by at least a factor of two).
MySQL governor comes with dbtop utility that allows you to see current MySQL usage patterns, as well as mysql_unfreeze utility that lest you re-enable all customers that were restricted due to server abuse.
Utilities
dbtop -- monitor MySQL usage on per user bases. More info...
db_governor -- daemon used to monitor and automatically restrict / unrestrict usage of MySQL by individual accounts
mysql_unfreeze -- unrestricts usage of MySQL for all accounts
Configuration
/etc/container/db-governor.xml -- contains configuration settings for MySQL governor. The settings should be optimized for your system. More info...
Log Files
/var/log/dbgovernor-restrict.log -- contains information each time MySQL governor took any actions to restrict the account. More info...
/var/log/dbgovernor-error.log -- contains errors and debugging information for MySQL governor. More info...
/var/log/dbgovernor-training.log -- contains training information. More info...
Starting and Stopping MySQL Governor
To start:
# service db_governor start
To stop:
# service db_governor stop
Installing MySQL Governor on cPanel server
To install MySQL governor on cPanel server, do:
# yum install cpanel-db-governor --enablerepo=cloudlinux-updates-testing
# perl /usr/share/lve/db_governor/utils/install-db-governor --force
* Please, note that MySQL on cPanel servers will be updated from CloudLinux RPMs.
** MySQL Governor is compatible only with MySQL 5.x
Installing MySQL Governor on server with RPM based control panel
As root, do:
# yum update mysql-server mysql --enablerepo=cloudlinux-updates-testing
# service mysql restart
# yum install db-governor --enablerepo=cloudlinux-updates-testing
# service db_governor restart
If you don't have mysql root login & password set in /root/.my.cnf -- you might want to edit that file, and add
[dbgovernor]
user=admin
password=<password for admin user>
Edit file /etc/container/db-governor.xml, and add:
<user mysql_name="admin" mode="ignore"/>
Upgrading MySQL Governor on cPanel server
Upgrade MySQL up to 5.0.91-4 or 5.1.52-3 based on previous installed version, and stop db governor
# perl /usr/share/lve/db_governor/utils/install-db-governor --force # yum update db-governor db-governor-mysql --enablerepo=cloudlinux-updates-testing
New config file is located at /etc/conatiner/db-governor.xml
Upgrading MySQL Governor on server with RPM based control panel
Update to latest MySQL binary from our cloudlinux-updates-testing repository, and stop db_governor service.
# yum update mysql
# yum update db-governor db-governor-mysql --enablerepo=cloudlinux-updates-testing
New config file is located at /etc/conatiner/db-governor.xml
Uninstalling MySQL Governor
On cPanel server:
# yum erase db-governor db-governor-mysql cpanel-db-governor # /scripts/upcp
Any other setup:
# yum erase db-governor db-governor-mysql
