MySQL Enterprise Monitor 3.0: viewing Query Analyzer for 5.5.x servers.
So, the good thing about MEM 3.0 is that it’s agentless, i.e. you don’t need an agent to use Query Analyzer data and see when performance is at it’s worst and dive into the offending SQL’s and explain plans to see what’s happening.
That’s great, however, sometimes it’s not always an easy road to migrate to 5.6 and even if you’re doing so, there’s nearly always a time when you want to continue viewing things in 5.5.x and compare performance between the 2.
The thing is, that in order to see the Explain Plans we need 5.6.14 or upwards (and setting “UPDATE performance_schema.setup_consumers SET enabled = ‘YES’ WHERE name = ‘events_statements_history_long';” ).
So, here’s how to do it:
- Use the MEM 2.3 Agent & proxy.
It’s really that simple. How simple? (Ref.Man: Using the 2.3 Agent Proxy)
- make sure you reply “yes” in order to use the “Proxy Enabled:”, default port 6446, and the “Backend Port:” is your MySQL Server’s port, 3306.
- next it’s going to ask you for a user that can connect to the server, in name of the agent, with the appropriate privileges, in order to retrieve all the info for the MEM 3 repository. I used “memagent23″. I pre-created this user as follows:
GRANT PROCESS ON *.* TO 'memagent23'@'127.0.0.1' IDENTIFIED BY password; GRANT SELECT, INSERT, UPDATE ON `sakila`.* TO 'memagent23'@'127.0.0.1'; GRANT SELECT ON `mysql`.`inventory` TO 'memagent23'@'127.0.0.1';
BUT, I bet you’ve looked on MEM 3 before installing any agent, and if you have another instance on the same server already being monitored, you’ve seen that it will have automatically detected the 5.5.x instance.
Did you click on ‘monitor unmonitored instance’? It doesn’t matter. If you did, no problems as, at the most, it will have created the required table mysql.inventory, that for earlier versions like 5.1.x we’d need to do this anyway.
Just delete this instance before we start up the proxied agent.
Now, let’s start the agent up, with the standard:
service mysql-monitor-agent start
In mysql-monitor-agent.log you will see what’s happening, and if there are any privilege errors, they’ll appear here.
If you’re on another server or whatever, you might want to test connectivity, just in case firewalls are enforcing rules that you’re unaware of, etc.
And depending on your setup, you should see your 5.6.x instances using the built-in 3.0 agent, and the 5.5.x using the 2.3 agent.
Time to show off:
- execute your app (or in my case, use Workbench and run some slow queries on sakila tables) and make sure you’re connecting to the proxy port, 6446, so that you’re feeding the MEM repository.
- Go to the Query Analyzer tab, click on the 5.5.x server, and you should start to see all the SQL queries, and then be able to click on them, and then choose the Explain Plan tab, and hey presto, we’re focused on SQL Tuning now.
I hope this has helped someone else.