Slow queries decrease the stability of ApsaraDB for Redis instances. To monitor and analyze slow queries, you can view the details about slow query logs in CloudDBA.
Procedure
- Log on to the ApsaraDB for Redis console and go to the Instances page. In the top navigation bar, select the region in which the instance is deployed. Then, find the instance and click the instance ID.
- In the left-side navigation pane, choose CloudDBA > Slow Queries.
- On the slow queries page, you can view Slow Log Trend and Slow Log Details.
- Slow Log Trend
In the Slow Log Trend section, you can view the number of slow query logs and CPU utilization for the instance in a specified period. You can click a specific point in time to view the slog query log details.
Note For master-replica cluster and read/write splitting instances, the following information is displayed: the slow query log details for data nodes and proxy nodes, and the number of slow queries of each node. - Slow Log Details
By default, the details of all slow queries are displayed in the following columns: Query Started At, Database Name, Slow Query Statement, Elapsed, and Host Address. You can click Set to filter the columns.
Note- You can click Export Slow Log in the upper-right corner to export slow query logs to a local storage for analysis.
- By default, the Host Address column for master-replica cluster and read/write splitting instances displays the
IP address of the proxy node. To obtain the IP address of a specific client, perform
the following operations:
- Performance-enhanced instances that use local disks: Set the ptod_enabled parameter in System Parameters to
1
. For more information, see Modify parameters of an instance. - Community Edition instances: Enable the audit log feature and view the client IP address in the specific events of the audit logs for the proxy node.
- Performance-enhanced instances that use local disks: Set the ptod_enabled parameter in System Parameters to
- Slow Log Trend