MySQL Governor is software that is used for monitoring and restricting MySQL usage in a shared hosting environment. MySQL usage and throttle abusers are monitored by Governor to prevent them from overloading the server, which improves overall stability and performance. It allows you to detect and throttle abusers automatically and keep your servers high-performance. Since keeping MySQL stable is difficult, it may be an issue for shared hosting companies. So, MySQL Governor plays its role just right here. In this article, you will learn Introducing And Install MySQL Governor On cPanel/WHM. You can Visit the available packages in Eldernode and purchase a VPS Hosting server.
Introducing MySQL Governor On CPanel/WHM
What is MySQL Governor?
MG (MySQL Governor) uses the dbtop utility to see the usage as it happens on a per-customer basis and to make sure that system admins are aware of happenings. dbtop tool is a CL package that will let system administrators look into what is happening at the MySQL level for each system user, pretty much like the classic mytop Unix utility. MySQL Governor tracks system usage per user and if found, it throttles the MySQL queries.
MySQL Governor Features:
1- Stable, simple limits counted as part of LVE limits.
2- Automatic detection and killing of long-running queries.
3- MySQL 5.1-5.7 support
4- MariaDB 5.x and 10.x support
Note: MariaDB 10.4 and 10.5 are not supported by CPanel.
MySQL Governor Multiple Modes
Depending on the configuration, MySQL Governor has multiple modes of operation:
Working on the mode of Monitor-only, using different throttling scenarios. Place all users that have reached their limits into a single predefined LVE.
Note: Place MySQL queries into user’s LVE, or place users into their LVE only when MySQL Governor limits have been reached which is the default mode of operation.
How to Install MySQL Governor On CPanel
You can install MySQL Governor since it is compatible with cPanle, DirectAdmin, Plesk, ISPManager, InterWorx, and even with plain based servers with no control panel. The instructions should work for any of the above types of servers, it is tested on a cPanel based box. You are recommended to create a full database backup including system tables before MySQL Governor installation.
To make a full backup of all your MySQL database and user privileges run:
mysqldump --all-databases > /root/all_databases.sql
Before starting the process of installing MySQL Governor, you need to remove previous packages if installed and you are running MySQL Server.
yum remove db-governor db-governor-mysql
Install MySQL Governor on cPanel / WHM
Let’s go through the steps of this guide to learn and finish it.
First, to install the governor-mysql package, run the following command:
yum install governor-mysql -y
Then, to complete the installation, run the below python script:
Now, if you are running MariaDB, use the following commands instead:
yum install governor-mysql
Next, when you run the command below make sure you replace ”mariadbXX” with the correct MariaDB version you are running.
1) For MariaDB v5.5, 55
2) For MariaDB v10.0, 100
3) For MariaDB v10.1, 101
Point: MariaDB version 10.4 is not available for CloudLinux 6 yet.
From now on, your CloudLinux system uses MySQL governor to monitor and limit your MySQL script abusers.
How to Configure MySQL Governor on WHM
MySQL Governor configuration is located below:
You are recommended to use the official dbctl utility when you want to edit its configuration manually. When you see all is ok, restart the system service to apply the changes:
service db_governor restart
You can also specify modes of operation using dbctl or by changing the configuration file. dbuser-map file is located in /etc/container/dbuser-map.
Starting and Stopping
service db_governor start
service db_governor stop
Uninstall MySQL Governor
Use the following command to remove MySQL Governor:
This article presented you with an Introducing And Install MySQL Governor On Cpanel/WHM. Different limits for different periods (1,5 seconds or 1 and 5 minutes) are possible to set such as current, short, med, and long. In case you are interested in learning more, find our article on Answer To MySQL Queries Troubleshooting and discuss with your friends on Eldernode Community.