What is MySQL Governor?
MySQL Governor is a module developed by CloudLinux that is used to monitor and limit MySQL or MariaDB loads on shared servers. It monitors resource-intensive MySQL queries in real-time and automatically manages users who exceed the limits.
The main purpose of this tool is to prevent database loading from harming other sites. Especially in shared hosting environments, thanks to MySQL Governor, the CPU and IO usage of each user can be limited.
How to Install MySQL Governor?
-
Prepare the CloudLinux environment:
yum groupinstall alt-server -y
-
Install the MySQL Governor package:
yum install governor-mysql -y
-
Install the compatible version instead of the default MySQL/MariaDB:
governor-mysql install --mysql-version=mariadb103
Supported versions:
-
MariaDB 10.1 - 10.11
-
MySQL 5.6 / 5.7 / 8.0
-
-
If upgrading (existing MySQL/MariaDB):
cl-update-db --mysql-version=mysql80
-
Enable MySQL Governor:
/usr/share/lve/dbgovernor/mysqlgovernor.py --install
-
Test if it is working:
dbtop
With this command, you can instantly monitor the IO and CPU usage of active users.
MariaDB or MySQL Upgrade Process (On Existing Servers)
After MySQL Governor is activated, the existing MySQL version can be edited.
/usr/share/lve/dbgovernor/mysqlgovernor.py --mysql-version=mariadb106 --install
Note: This module does not work stably without using the CloudLinux kernel. In addition, it must be compatible with CageFS and LVE.
Advantages
-
MySQL queries that use high resources are instantly monitored.
-
Overload problems on the server are minimized.
-
CPU and IO based user limits can be applied.
-
Queries with attack characteristics can be terminated automatically.
-
Integrated monitoring with the WHM panel becomes possible.
Disadvantages / Things to Consider
-
Since it is a kernel-based system, it only works in the CloudLinux environment.
-
A database backup must be taken before installation.
-
Malfunctions may occur in incompatible WHM/cPanel systems.
Usage Via WHM Panel
WHM > CloudLinux LVE Manager > The following operations can be performed from the MySQL Governor tab:
-
Active MySQL usage graph
-
Setting query limits on a per-user basis
-
Reviewing logs of previous installations
Conclusion
If you are managing a hosting infrastructure in a CloudLinux environment, the MySQL Governor module is absolutely essential for ensuring system stability and resource balance between other customers. It can be integrated with just a few lines of code and controlled from the WHM panel.