Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does Amazon RSD view slow_log

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly shows you "Amazon RSD how to view slow_log", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "Amazon RSD how to view slow_log" this article.

Amazon RSD View slow_log

Amazon RSD does not provide SSH direct access to db server.

However, Amazon RDS Command Line Toolkit is provided, but it is not so convenient to adjust some system parameters of mysql.

Here we mainly record the operation of viewing slow_log.

1 、 Amazon RDS Command Line Toolkit

Http://aws.amazon.com/developertools/2928

This machine decompresses, the configuration environment variable can be used. For more information, please see http://docs.amazonwebservices.com/AmazonRDS/latest/CommandLineReference/StartCLI.html

2. Create a DB Parameter group

$rds-create-db-parameter-group-db-parameter-group-name testgroup

3. Modify the parameter group of db instance

$rds-modify-db-instance DBInstanceIdentifier-db-parameter-group-name testgroup

4. Modify the relevant system parameter www.2cto.com in testgroup

/ / record SQL statements that do not use indexes

$rds-modify-db-parameter-group upondefault-- parameters "name=log_queries_not_using_indexes,value= [color = red] on [/ color], method=immediate"

/ / set the time threshold for slow query to 1 second.

$rds-modify-db-parameter-group upondefault-parameters "name=long_query_time,value=1,method=immediate"

/ / record slow query SQL statement

$rds-modify-db-parameter-group upondefault-- parameters "name=slow_query_log,value= [color = red] on [/ color], method=immediate"

Because the above three parameters are all dynamic, it is not necessary to restart DB instance.

5. Access mysql server through the client.

$mysql-h hostname-uusername-ppassword

Mysql > use mysql; www.2cto.com

Mysql > show tables

+-+

| | Tables_in_mysql |

+-+

| | columns_priv |

| | db |

| | event |

| | func |

| | general_log |

| | help_category |

| | help_keyword |

| | help_relation |

| | help_topic |

| | host |

| | ndb_binlog_index |

| | plugin |

| | proc |

| | procs_priv |

| | rds_sysinfo |

| | servers |

| | slow_log |

| | tables_priv |

| | time_zone |

| | time_zone_leap_second |

| | time_zone_name |

| | time_zone_transition |

| | time_zone_transition_type |

| | user |

+-+

The slow_log table above is the table that needs to be viewed. The records in this slow_log table cannot be deleted.

Because slow_log actually maps to a csv file. But with this, we can quickly

Locate the sql that slows down the system performance.

Mysql > select * from slow_log order by query_time desc limit 100

Recording slow_log will affect the performance of the system and can be turned off after recording for a period of time.

Rds-modify-db-parameter-group upondefault-- parameters "name=log_queries_not_using_indexes,value= [color = red] off [/ color], method=immediate"

Rds-modify-db-parameter-group upondefault-- parameters "name=slow_query_log,value= [color = red] off [/ color], method=immediate"

The above is all the contents of the article "how to check slow_log by Amazon RSD". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report