{"id":1235,"date":"2013-09-22T10:05:33","date_gmt":"2013-09-22T01:05:33","guid":{"rendered":"http:\/\/kazu.tv\/blog\/?p=1235"},"modified":"2013-09-27T12:00:37","modified_gmt":"2013-09-27T03:00:37","slug":"amazon-rds-mysql%e3%81%aeslow-query-log%e3%82%92%e9%9b%86%e8%a8%88%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/kazu.tv\/blog\/2013\/09\/22\/amazon-rds-mysql%e3%81%aeslow-query-log%e3%82%92%e9%9b%86%e8%a8%88%e3%81%99%e3%82%8b\/","title":{"rendered":"Amazon RDS (MySQL)\u306eslow query log\u3092\u96c6\u8a08\u3059\u308b"},"content":{"rendered":"<h2>RDS\u3067\u306fslow query log\u306f\u30c6\u30fc\u30d6\u30eb\u306b\u66f8\u304d\u3060\u3055\u308c\u308b\u3002<\/h2>\n<p>Amazon RDS\u306eMySQL\u3067\u306f\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306fslow query log\u306fmysql\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306eslow_log\u3068\u3044\u3046\u30c6\u30fc\u30d6\u30eb\u306b\u4fdd\u5b58\u3055\u308c\u308b(\u203b)\u3002<\/p>\n<p>\u4eca\u307e\u3067\u306e\u666e\u901a\u306eMySQL\u3067\u3042\u308c\u3070\u3001slow query log\u3092\u6709\u52b9\u5316\u3059\u308b\u3068\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u304d\u3060\u3055\u308c\u3066\u3001\u305d\u308c\u3092mysqldumpslow\u3067\u96c6\u8a08\u30fb\u89e3\u6790\u3059\u308b\u3063\u3066\u306e\u304c\u4e00\u822c\u7684\u3060\u3063\u305f\u3068\u601d\u3046\u3051\u3069\u3001\u30c6\u30fc\u30d6\u30eb\u306b\u66f8\u304d\u3060\u3055\u308c\u308b\u3068\u3001\u305d\u308c\u306b\u3082\u3046\u4e00\u624b\u9593\u5fc5\u8981\u306b\u306a\u3063\u3066\u304f\u308b\u3002<\/p>\n<p>\u203b\u4ee5\u524d\u306f\u3001slow_log\u30c6\u30fc\u30d6\u30eb\u306b\u66f8\u304d\u51fa\u3059\u4ee5\u5916\u306b\u9078\u629e\u80a2\u306f\u7121\u304b\u3063\u305f\u3068\u601d\u3046\u3051\u3069\u3001\u6700\u8fd1\u306f\u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u304d\u51fa\u3059\u3053\u3068\u3082\u51fa\u6765\u308b\u3089\u3057\u3044\u3002<\/p>\n<h2>\u5927\u307e\u304b\u306a\u65b9\u91dd<\/h2>\n<ol>\n<li>slow_log\u30c6\u30fc\u30d6\u30eb\u304b\u3089\u901a\u5e38\u306eslow query log\u30d5\u30a1\u30a4\u30eb\u5f62\u5f0f\u306b\u30a8\u30af\u30b9\u30dd\u30fc\u30c8<\/li>\n<li>mysqldumpslow\u3067\u96c6\u8a08<\/li>\n<\/ol>\n<h2>slow_log\u3092\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u3059\u308b\u30c4\u30fc\u30eb2\u3064<\/h2>\n<h3>python\u306e\u30b9\u30af\u30ea\u30d7\u30c8<\/h3>\n<p>AWS\u306e\u30d5\u30a9\u30fc\u30e9\u30e0\u306e<a href=\"https:\/\/forums.aws.amazon.com\/thread.jspa?messageID=302276#\" target=\"_blank\">\u30b9\u30ec\u30c3\u30c9<\/a>\uff08AWS\u306b\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3044\u306a\u3044\u3068\u898b\u3089\u308c\u306a\u3044\uff09\u3067\u898b\u3064\u3051\u305f\u3053\u3061\u3089\u306e<a title=\"slow_log\u30c6\u30fc\u30d6\u30eb\u3092\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u3059\u308bpython\u30b9\u30af\u30ea\u30d7\u30c8\" href=\"https:\/\/gist.github.com\/memonic\/1481025\" target=\"_blank\">\u30b9\u30af\u30ea\u30d7\u30c8\u3002<\/a><\/p>\n<p>mysql\u95a2\u9023\u306e\u30e2\u30b8\u30e5\u30fc\u30eb\u304c\u306a\u3044\u3068\u52d5\u304b\u306a\u3044\u306e\u3067\u3001\u4eca\u56de\u306f\u4f7f\u7528\u305b\u305a\u3002<\/p>\n<h3>\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8<\/h3>\n<p>MySQL Performance Blog\u306e<a title=\"Analyzing Slow Query Table in MySQL 5.6\" href=\"http:\/\/www.mysqlperformanceblog.com\/2013\/02\/18\/slow-query-table-in-mysql-5-6\/\" target=\"_blank\">\u8a18\u4e8b<\/a>\u3067\u7d39\u4ecb\u3055\u308c\u3066\u3044\u305f\u3053\u3061\u3089\u306e<a href=\"https:\/\/github.com\/billkarwin\/bk-tools\" target=\"_blank\">\u30c4\u30fc\u30eb\u7fa4<\/a>\u3002\u305d\u3053\u306b<a title=\"export-slow-log-table\" href=\"https:\/\/github.com\/billkarwin\/bk-tools\/blob\/master\/export-slow-log-table\" target=\"_blank\">export-slow-log-table<\/a>\u3068\u3044\u3046\u30b9\u30af\u30ea\u30d7\u30c8\u304c\u3042\u308b\u306e\u3067\u3001\u305d\u308c\u3092\u4f7f\u3046\u3002\u5148\u982d\u306b\u4ee5\u4e0b\u306e\u884c\u3092\u8ffd\u52a0\u3057\u3066\u3001<\/p>\n<pre class=\"brush: plain\">#!\/bin\/bash<\/pre>\n<p>.my.cnf \u306b\u30db\u30b9\u30c8\u540d\u3001\u30e6\u30fc\u30b6\u30fc\u540d\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a18\u8f09\u3057\u3066\u3001<\/p>\n<pre class=\"brush: plain\">[client]\r\nhost=xxx.yyy.ap-northeast-1.rds.amazonaws.com\r\nuser=awsuser\r\npassword=secretpassword<\/pre>\n<p>\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3059\u308c\u3070OK\u3002<\/p>\n<h2>\u305d\u306e\u5f8c<\/h2>\n<p>\u3042\u3068\u306f\u901a\u5e38\u901a\u308a\u3001\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u3092mysqldumpslow\u3067\u96c6\u8a08\u3059\u308b\u3002<\/p>\n<p>\u96c6\u8a08\u304c\u7d42\u308f\u3063\u305f\u3089slow_log\u30c6\u30fc\u30d6\u30eb\u306e\u5185\u5bb9\u306f\u4e0d\u8981\u3060\u3068\u601d\u3046\u306e\u3067\u3001\u4ee5\u4e0b\u306e\u30b9\u30c8\u30a2\u30c9\u30d7\u30ed\u30b7\u30b8\u30e3\u3067\u30ed\u30fc\u30c6\u30fc\u30c8\u3057\u3066\u304a\u304f\u3002<\/p>\n<pre class=\"brush: plain;\">CALL mysql.rds_rotate_slow_log;<\/pre>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>Amazon RDS (MySQL) \u3067\u306f\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306fslow query log\u306fslow_log\u3068\u3044\u3046\u30c6\u30fc\u30d6\u30eb\u306b\u66f8\u304d\u8fbc\u307e\u308c\u308b\u306e\u3067\u3001\u305d\u308c\u3092\u30d5\u30a1\u30a4\u30eb\u306b\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u3057\u3066mysqldumpslow\u3067\u96c6\u8a08\u3059\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u305f\u3002\u3067\u3001\u305d\u306e\u7d50\u679c\u3092\u5229\u7528\u3057\u3066\u30dc\u30c8\u30eb\u30cd\u30c3\u30af\u306e\u8abf\u67fb\u30fb\u5206\u6790\u3092\u3059\u308b\u3001\u3068\u3044\u3046\u6d41\u308c\u3002<\/p>\n<p>slow query log\u3092\u5b9a\u671f\u7684\u306b\u78ba\u8a8d\u3057\u3066\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3092\u6539\u5584\u3055\u305b\u308b\u904b\u7528\u30d5\u30ed\u30fc\u3092\u4f5c\u3063\u3066\u304a\u304f\u3068\u3001\u30b7\u30b9\u30c6\u30e0\u306e\u898f\u6a21\u304c\u5927\u304d\u304f\u306a\u3063\u305f\u6642\u306b\u3082\u5b89\u5fc3\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>RDS\u3067\u306fslow query log\u306f\u30c6\u30fc\u30d6\u30eb\u306b\u66f8\u304d\u3060\u3055\u308c\u308b\u3002 Amazon RDS\u306eMySQL\u3067\u306f\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306fslow query log\u306fmysql\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306eslow_log\u3068\u3044\u3046\u30c6\u30fc\u30d6\u30eb\u306b\u4fdd\u5b58\u3055\u308c\u308b(\u203b)&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[15],"tags":[178,740],"class_list":["post-1235","post","type-post","status-publish","format-standard","hentry","category-15","tag-mysql","tag-740"],"_links":{"self":[{"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/posts\/1235","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/comments?post=1235"}],"version-history":[{"count":3,"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/posts\/1235\/revisions"}],"predecessor-version":[{"id":1243,"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/posts\/1235\/revisions\/1243"}],"wp:attachment":[{"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/media?parent=1235"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/categories?post=1235"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/tags?post=1235"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}