>데이터 베이스 >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
WBOY원래의
2016-06-01 13:12:561179검색

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.

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.