7.1.6.1 Enabling Query Analyzer by Changing the MySQL Client Application

Generally, changing your MySQL client application is the easiest and recommended method. For example, given a typical structure like the one in the following figure, you would modify the client application so that it communicated to the proxy rather than directly with the MySQL server,

Figure 7.4 Standard 2.3 Agent/Monitor Topology

Standard 2.3 agent/monitor topology

The following figure shows an example of the structure when communicating through the proxy:

Figure 7.5 Query Analyzer 2.3 Agent/Monitor Topology

Query Analyzer 2.3 agent/monitor topology

To enable Query Analyzer within your MySQL client application:

  1. Make sure that the MySQL Enterprise Service Manager and your 2.3 MySQL Enterprise Monitor Agent are configured and running.

  2. Confirm the configuration of your 2.3 agent by examining the contents of the etc/mysql-monitor-agent.ini file within your installed 2.3 Agent directory.

    Queries are sent to the host specified in the proxy-backend-addresses parameter, and the 2.3 agent listens for connections to be redirected to the server on the host name and port configured in the proxy-address parameter.

  3. Now modify your MySQL client application to communicate with the address specified in the proxy-address parameter.

    Alternatively, if you do not want to modify your application directly, you can use iptables or firewall rules to redirect queries from the original host/port combination to the 2.3 agent's port.

    Because connections to the MySQL server come from the proxy, not the original host, the user credentials must be have a suitable GRANT statement for connections from localhost, or the host on which the 2.3 agent and its proxy component run. The user name and password information are passed directly through the proxy from the client to the server.

  4. Confirm that your MySQL client application still operates normally. There should be no difference between communicating directly with the MySQL server and communicating via the proxy.

Note

If you are using the mysql client to connect to the proxy and your backend servers, make sure that you are communicating with the proxy over the right port. By default, if you specify localhost as the host name, then mysql connects using the local Unix domain socket, rather than the TCP/IP socket.

You can enforce mysql to use the right port either by explicitly requesting the protocol type, or by using the IP address rather than localhost. For example, both of these command lines start the client using the right protocol:

shell> mysql --port=6446 --protocol=tcp
shell> mysql --port=6446 --host=127.0.0.1
Note

It is recommended that you use one 2.3 agent and associated proxy per MySQL server instance. A single proxy is not able to forward queries to multiple MySQL server backends.