首頁 > 資料庫 > mysql教程 > MySQL Enterprise Monitor 3.0: viewing Query Analyzer for 5.5_MySQL

MySQL Enterprise Monitor 3.0: viewing Query Analyzer for 5.5_MySQL

WBOY
發布: 2016-06-01 13:12:56
原創
1202 人瀏覽過

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 worth 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)

./mysqlmonitoragent-2.3.17.2217-linux-glibc2.3-x86-64bit-installer.bin
登入後複製

- 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;<br>GRANT SELECT, INSERT, UPDATE ON `sakila`.* TO 'memagent23'@'127.0.0.1';<br>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.

來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板