View slow_log with Amazon RSD

Source: Internet
Author: User


Amazon RSD viewing slow_log amazon RSD does not provide SSH direct access to the 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 operations for viewing slow_log. 1. Download the Amazon RDS Command Line Toolkit http://aws.amazon.com/?tools/2928script to decompress the script, and configure the environment variable. See http://docs.amazonwebservices.com/AmazonRDS/latest/CommandLineReference/StartCLI.html for details
2. create a DB Parameter group $ rds-create-db-parameter-group -- db-parameter-group-name testgroup3. modify the parameter group of the db instance $ rds-modify-db- instance DBInstanceIdentifier -- db-parameter-group-name testgroup4. modify the system parameter www.2cto.com in testgroup. // record the SQL statement that does not use indexes. $ rds-modify-db-parameter-group upondefault -- parameters "name = log_queries_not_using_indexes, value = [color = red] ON [/color], method = immediate "// you can specify a time threshold for a slow query. 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 dynamic parameters, you do not have to restart the DB instance. 5. Access the mysql server through the mysql client. $ Mysql-h hostname-uusername-ppasswordmysql> use mysql; www.2cto.com mysql> show tables; + metrics + | Tables_in_mysql | + metrics + | 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 | ti Me_zone | time_zone_leap_second | time_zone_name | time_zone_transition | time_zone_transition_type | user | + region + The slow_log table above is the table to be viewed. Records in this slow_log table cannot be deleted. Because slow_log is actually mapped to a csv file. However, with this, we can quickly locate the SQL statement that slows down the system performance. Mysql> select * from slow_log order by query_time desc limit 100; record slow_log will affect the system performance and can be closed after 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 "author berdy

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.