The following setup is only applicable to users with the Application Control Module or Application Edition running on 5.3 or higher.
If you do not have the Application Control Module or Application Edition, please contact your Customer Experience representative or your Account Executive for licensing.
Ensure your Turbonomic appliance is running 5.3 or higher. Follow these instructions to update:
Table of Contents
In this document we’ll review how to setup control for MySQL Databases.
Enable Remote Access
See How Do I Enable Remote Access To MySQL Database Server? for the original article.
1) Login to the MySQL server. Open a console or SSH session into the MySQL database server. Login as the root user.
2) Edit the my.cnf file. Once connected you need to edit the MySQL server configuration file my.cnf using a text editor such as vi:
- If you are using Debian Linux file is located at /etc/mysql/my.cnf location.
- If you are using Red Hat Linux/Fedora/Centos Linux file is located at /etc/my.cnf location.
- If you are using FreeBSD you need to create a file /var/db/mysql/my.cnf location.
Edit the /etc/my.cnf run:
# vi /etc/my.cnf
3) Once the file is opened, locate the line that reads as follows
Ensure the line skip-networking is commented (or remove line) and add following line:
For example, if your MySQL server IP is 18.104.22.168 then entire block should be look like as follows:
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/English
bind-address = 22.214.171.124
- bind-address: IP address to bind to.
- skip-networking : Don’t listen for TCP/IP connections at all. All interaction with mysqld must be made via Unix sockets. This option is highly recommended for systems where only local requests are allowed. Since you need to allow remote connection this line should be removed from my.cnf or put it in comment state.
4) Save and Close the file.
If you are using Debian / Ubuntu Linux, type the following command to restart the mysql server:
# /etc/init.d/mysql restart
If you are using RHEL / CentOS / Fedora / Scientific Linux, type the following command to restart the mysql server:
# /etc/init.d/mysqld restart
If you are using FreeBSD, type the following command to restart the mysql server:
# /usr/local/etc/rc.d/mysql-server stop
# /usr/local/etc/rc.d/mysql-server start
# /usr/local/etc/rc.d/mysql-server restart
Open the Firewall for the MySQL Port
The firewall on the VM containing the MySQL instance must allow connections to the public MySQL por
1) Open TCP port 3306 using iptables or BSD pf firewall.
A sample iptables rule to open Linux iptables firewall:
/sbin/iptables -A INPUT -i eth0 -p tcp --destination-port 3306 -j ACCEPT
OR only allow remote connection from your web server located at 10.5.1.3 (use the address of Turbonomic:
/sbin/iptables -A INPUT -i eth0 -s 10.5.1.3 -p tcp --destination-port 3306 -j ACCEPT
OR only allow remote connection from your lan subnet 192.168.1.0/24 (use the lan subnet that Turbonomic is on:
/sbin/iptables -A INPUT -i eth0 -s 192.168.1.0/24 -p tcp --destination-port 3306 -j ACCEPT
2) Save all rules (RHEL / CentOS specific command):
# service iptables save
A sample FreeBSD / OpenBSD / NetBSD pf firewall rule ( /etc/pf.conf)
Use the following to open port 3306 on a BSD based systems:
pass in on $ext_if proto tcp from any to any port 3306
OR allow only access from your web server located at 10.5.1.3 (use the address of Turbonomic):
pass in on $ext_if proto tcp from 10.5.1.3 to any port 3306 flags S/SA synproxy state
There are any number of good articles explaining how to open a firewall port for your version of Windows. Web search is your friend.
MySQL must be configured to capture the metrics required for the MySQL mediation.
VMWare Tools must be installed on the VM hosting the MySQL instance, in order for the IP address of the VM to be collected by the Hypervisor probe.
The performance schema must be enabled. Issue the following statement. The Value column value must be ON.
SHOW VARIABLES LIKE 'performance_schema';
If not, please see https://dev.mysql.com/doc/refman/5.6/en/performance-schema-quick-start.html for instructions on how to enable performance schema.
The metrics used for transactions must be enabled. Issue the following statement. The status column value must be enabled for the rows with the names trx_rw_commits, trx_nl_ro_commits, trx_ro_commits, trx_rollbacks.
SELECT name, subsystem, status FROM INFORMATION_SCHEMA.INNODB_METRICS ORDER BY NAME;
If not, issue the following statements.
SET GLOBAL innodb_monitor_enable = trx_rw_commits;
SET GLOBAL innodb_monitor_enable = trx_nl_ro_commits;
SET GLOBAL innodb_monitor_enable = trx_ro_commits;
SET GLOBAL innodb_monitor_enable = trx_rollbacks;
Response Time Metrics
The metrics used for response time must be enabled. Issue the following statement. The values in the enabled and timed columns for all rows must be YES.
If not, issue the following statements.
UPDATE performance_schema.setup_instruments SET ENABLED = 'YES' WHERE NAME LIKE 'statement/%';
UPDATE performance_schema.setup_instruments SET TIMED = 'YES' WHERE NAME LIKE 'statement/%';
Create a User
A MySQL user with remote access to the MySQL instance and sufficient permission to access the required metrics must be defined.
There are several ways to define a user and most likely your DBA is the best person to do it for you.
A simple way to define a user with the least amount of privileges required is by issuing the following statements. Replace <IP_ADDRESS> with the IP address of your Turbonomic instance. Replace the IDENTIFIED BY value with the password of your choice.
CREATE USER 'leastpriv'@'<IP_ADDRESS>' IDENTIFIED BY 'vmturbo';
GRANT SELECT ON performance_schema.* TO 'leastpriv'@'<IP_ADDRESS>';
GRANT PROCESS ON *.* TO 'leastpriv'@'<IP_ADDRESS>';
Add the MySQL Target
MySQL Targets can be address targets or scope targets. In this example, we will target an address MySQL target.
1) Go to Admin > Workflows > Target Configuration > Database > MySQL.
2) The Address is the IP address or DNS name of the MySQL target. The Port number is 3306, the port we opened on the firewall. The Username and Password are the credentials we defined above.
3) Click the Add button. The target should appear on the Pending Targets list. Click Apply. The Target Configuration page will appear. Click Rediscover or Rediscover All.
4) After discovery and regrouping have completed you will see the MySQL instances in the list of database servers:
You will be able to see decisions based on the demand of the application from the virtual machine. Metrics collected vary with MySQL version, and include:
- Database memory
- Database CPU usage (MySQL 5.6 and later)
- Response Time
- Cache Hit Rate