{"id":1630,"date":"2011-10-15T15:21:55","date_gmt":"2011-10-15T06:21:55","guid":{"rendered":"http:\/\/blog.isnext.net\/issy\/?p=1630"},"modified":"2011-10-15T15:22:44","modified_gmt":"2011-10-15T06:22:44","slug":"mysql%e3%81%ae%e9%9a%9c%e5%ae%b3%e3%82%92%e7%9b%a3%e8%a6%96%e3%81%99%e3%82%8b%e5%90%84%e7%a8%ae%e8%a8%ad%e5%ae%9a%e3%83%a1%e3%83%a2","status":"publish","type":"post","link":"https:\/\/blog.isnext.net\/issy\/archives\/1630","title":{"rendered":"mysql\u306e\u969c\u5bb3\u3092\u76e3\u8996\u3059\u308b\u5404\u7a2e\u8a2d\u5b9a\u30e1\u30e2"},"content":{"rendered":"<p><strong>mysql\u306e\u969c\u5bb3\u3092\u76e3\u8996\u3059\u308b\u5404\u7a2e\u8a2d\u5b9a\u30e1\u30e2<\/strong><br \/>\n\u3000mysql\u304c\u904e\u8ca0\u8377\u306b\u306a\u308b\u73fe\u8c61\u304c\u78ba\u8a8d\u3055\u308c\u305f\u306e\u3067\u3001\u969c\u5bb3\u5bfe\u5fdc\u3068\u76e3\u8996\u3092\u5f37\u5316\u3059\u308b\u305f\u3081\u306b\u884c\u3063\u305f\u4f5c\u696d\u306e\u30e1\u30e2\u3002<\/p>\n<p><strong>\u25a0munin\u306b\u3088\u308b\u76e3\u8996\u306e\u8ffd\u52a0<\/strong><br \/>\n<strong>\u30fbmunin\u306f\u5c0e\u5165\u6e08\u307f\u306e\u60f3\u5b9a<\/strong><br \/>\n\u3000\/usr\/share\/munin\/plugins\/mysql_ \u3092\u5229\u7528\u3059\u308b<\/p>\n<p><strong>\u30fb\u57fa\u672c\u76e3\u8996\u53ef\u80fd\u9805\u76ee\u306e\u30ea\u30b9\u30c8<\/strong>\u3000\u51fa\u529b\u3055\u308c\u305f\u9805\u76ee\u304c\u8a2d\u5b9a\u53ef\u80fd<br \/>\n\u3000# \/usr\/share\/munin\/plugins\/mysql_ suggest<br \/>\n\u3000Cache::Cache\u306e\u30a8\u30e9\u30fc\u304c\u51fa\u308b\u5834\u5408\u306f\u4ee5\u4e0b\u3092\u5b9f\u884c<br \/>\n\u3000# yum install perl-Cache-Cache<\/p>\n<p><strong>\u30fb\u57fa\u672c\u76e3\u8996\u9805\u76ee\u3092\u8a2d\u5b9a<\/strong><br \/>\n\u3000# cd \/etc\/munin\/plugins<br \/>\n\u3000# ln -s \/usr\/share\/munin\/plugins\/mysql_ mysql_commands<br \/>\n\u3000# ln -s \/usr\/share\/munin\/plugins\/mysql_ mysql_connections<br \/>\n\u3000# ln -s \/usr\/share\/munin\/plugins\/mysql_ mysql_slow<br \/>\n\u3000# ln -s \/usr\/share\/munin\/plugins\/mysql_ mysql_myisam_indexes<br \/>\n\u3000# ln -s \/usr\/share\/munin\/plugins\/mysql_ mysql_network_traffic<br \/>\n\u3000# ln -s \/usr\/share\/munin\/plugins\/mysql_ mysql_qcache<br \/>\n\u3000# ln -s \/usr\/share\/munin\/plugins\/mysql_ mysql_qcache_mem<\/p>\n<p><strong>\u30fb\u8a2d\u5b9a\u306e\u8ffd\u52a0<\/strong><br \/>\n\u3000# vi \/etc\/munin\/plugin-conf.d\/munin-node<br \/>\n\u3000\u4ee5\u4e0b\u3092\u8ffd\u8a18<br \/>\n\u3000[mysql_*]<br \/>\n\u3000env.mysqlconnection DBI:mysql:mysql;host=127.0.0.1;port=3306<br \/>\n\u3000env.mysqluser root<br \/>\n\u3000env.mysqlpassword password<\/p>\n<p><strong>\u30fb\u30c7\u30fc\u30bf\u53d6\u5f97\u3067\u304d\u3066\u3044\u308b\u304b\u52d5\u4f5c\u78ba\u8a8d\u3059\u308b<\/strong><br \/>\n\u3000# \/usr\/sbin\/munin-run -servicedir \/etc\/munin\/plugins mysql_commands<br \/>\n\u3000# \/usr\/sbin\/munin-run -servicedir \/etc\/munin\/plugins mysql_connections<br \/>\n\u3000# \/usr\/sbin\/munin-run -servicedir \/etc\/munin\/plugins mysql_slow<br \/>\n\u3000# \/usr\/sbin\/munin-run -servicedir \/etc\/munin\/plugins mysql_myisam_indexes<br \/>\n\u3000# \/usr\/sbin\/munin-run -servicedir \/etc\/munin\/plugins mysql_network_traffic<br \/>\n\u3000# \/usr\/sbin\/munin-run -servicedir \/etc\/munin\/plugins mysql_qcache<br \/>\n\u3000# \/usr\/sbin\/munin-run -servicedir \/etc\/munin\/plugins mysql_qcache_mem<\/p>\n<p><strong>\u30fb\u8a2d\u5b9a\u3092\u6709\u52b9\u306b\u3059\u308b<\/strong><br \/>\n\u3000# service munin-node restart<\/p>\n<p><strong>\u25a0mysql\u306b\u969c\u5bb3\u5bfe\u5fdc\u7528\u30ed\u30b0\u53d6\u5f97\u8a2d\u5b9a\u3092\u8ffd\u8a18<\/strong><br \/>\n<strong>\u30fbslow\u30ed\u30b0\u3068\u30d0\u30a4\u30ca\u30ea\u30fc\u30ed\u30b0\u3092\uff17\u65e5\u5206\u51fa\u529b\u3059\u308b<\/strong><br \/>\n\u3000# vi \/etc\/my.cnf<br \/>\n\u3000log-slow-queries=\/var\/log\/mysql\/slow.log<br \/>\n\u3000long_query_time=3<br \/>\n\u3000log-bin = \/var\/log\/mysql\/mysql-bin<br \/>\n\u3000set-variable = expire_logs_days=7<\/p>\n<p><strong>\u30fb\u4fdd\u5b58\u5834\u6240\u3092\u4f5c\u6210\u3057\u3066mysql\u3092\u518d\u8d77\u52d5<\/strong><br \/>\n\u3000# mkdir \/var\/log\/mysql<br \/>\n\u3000# chown -R mysql:mysql \/var\/log\/mysql<br \/>\n\u3000# service mysqld restart<\/p>\n<p><strong>\u25a0\u7a3c\u50cd\u4e2d\u306emysql\u306e\u72b6\u614b\u628a\u63e1\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b<\/strong><br \/>\n<strong>\u30fbmytop\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/strong><br \/>\n\u3000# yum install mytop<\/p>\n<p><strong>\u30fb\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b<\/strong><br \/>\n\u3000# vi ~\/.mytop<br \/>\n\u3000\u4ee5\u4e0b\u306e\u5185\u5bb9\u3092\u8a2d\u5b9a\u306b\u5408\u308f\u305b\u3066\u8a18\u5165<br \/>\n\u3000user=root<br \/>\n\u3000pass=password<br \/>\n\u3000host=localhost<br \/>\n\u3000db=mysqldbname<br \/>\n\u3000delay=3<br \/>\n\u3000port=3306<br \/>\n\u3000socket=<br \/>\n\u3000batchmode=0<br \/>\n\u3000header=1<br \/>\n\u3000color=1<br \/>\n\u3000idle=1<\/p>\n<p><strong>\u30fbmytop\u3092\u5b9f\u884c\u3059\u308b<\/strong><br \/>\n\u3000# mytop<br \/>\n\u3000\u7d42\u4e86\u6642\u306fq\u30ad\u30fc<\/p>\n<p><strong>\u30fbinnotop\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/strong><br \/>\n\u3000# yum install innotop<\/p>\n<p><strong>\u30fbinnotop\u3092\u8d77\u52d5\u3059\u308b<\/strong><br \/>\n\u3000# innotop<br \/>\n\u3000\u753b\u9762\u306e\u6307\u793a\u306b\u5f93\u3044\u8a2d\u5b9a\u3092\u5165\u529b\u3059\u308b<br \/>\n\u3000\u30d8\u30eb\u30d7\u306f?\u3001\u7d42\u4e86\u306fq\u30ad\u30fc<\/p>\n<p><strong>\u30fbinnotop\u306e\u8a2d\u5b9a\u3092\u7de8\u96c6\u3059\u308b<\/strong><br \/>\n\u3000# vi ~\/.innotop\/innotop.ini<br \/>\n\u3000connections\u306e\u8a2d\u5b9a\u3092\u7de8\u96c6<br \/>\n\u3000mysqldbname=user=root pass=password have_user= have_pass=<br \/>\n\u3000 dsn=DBI:mysql:;host=localhost;port=3306 savepass= dl_table=<\/p>\n<p><strong>\u25a0\u30d7\u30ed\u30bb\u30b9\u76e3\u8996\u30c4\u30fc\u30eb\u3092\u8ffd\u52a0\u3059\u308b<\/strong><br \/>\n<strong>\u30fbatop\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/strong><br \/>\n\u3000# yum install atop<br \/>\n\u3000\u5b9f\u884c\u306f\u4ee5\u4e0b<br \/>\n\u3000# atop<br \/>\n\u3000\u7570\u5e38\u5024\u3092\u8272\u3067\u793a\u3057\u3066\u304f\u308c\u308b\u306e\u3067\u308f\u304b\u308a\u3084\u3059\u3044<\/p>\n<p><strong>\u25a0\u30d7\u30ed\u30bb\u30b9\u306e\u72b6\u6cc1\u3092\u76e3\u8996\u3059\u308b\u8a2d\u5b9a\u3092munin\u306b\u8ffd\u52a0\u3059\u308b<\/strong><br \/>\n<strong>\u30fbuser\u5358\u4f4d\u306e\u4f7f\u7528\u72b6\u6cc1\u3092\u78ba\u8a8d\u53ef\u80fd\u306amunin\u30d7\u30e9\u30b0\u30a4\u30f3cpubyuser\u3092\u8a2d\u5b9a\u3059\u308b<\/strong><br \/>\n\u3000http:\/\/exchange.munin-monitoring.org\/plugins\/cpubyuser\/details<br \/>\n\u3000# cd \/usr\/share\/munin\/plugins\/<br \/>\n\u3000# wget http:\/\/exchange.munin-monitoring.org\/plugins\/cpubyuser\/version\/1\/download<br \/>\n\u3000# mv download cpubyuser<\/p>\n<p><strong>\u30fbcpubyuser\u306e\u8a2d\u5b9a\u3092\u8ffd\u52a0<\/strong><br \/>\n\u3000# vi \/etc\/munin\/plugin-conf.d\/munin-node<br \/>\n\u3000\u4ee5\u4e0b\u76e3\u8996\u3057\u305f\u3044user\u540d\u3092\u8ffd\u8a18<br \/>\n\u3000[cpubyuser]<br \/>\n\u3000env.USERS root postfix mysql apache munin munin-node<\/p>\n<p><strong>\u30fbprocess\u5358\u4f4d\u306e\u4f7f\u7528\u72b6\u6cc1\u3092\u78ba\u8a8d\u53ef\u80fd\u306amunin\u30d7\u30e9\u30b0\u30a4\u30f3cpu_by_process\u3092\u8a2d\u5b9a\u3059\u308b<\/strong><br \/>\n\u3000http:\/\/exchange.munin-monitoring.org\/plugins\/cpu_by_process\/details<br \/>\n\u3000# wget http:\/\/exchange.munin-monitoring.org\/plugins\/cpu_by_process\/version\/1\/download<br \/>\n\u3000# mv download cpu_by_process<\/p>\n<p><strong>\u30fbcpu_by_process\u306e\u8a2d\u5b9a\u3092\u8ffd\u52a0<\/strong><br \/>\n\u3000# vi \/etc\/munin\/plugin-conf.d\/munin-node<br \/>\n\u3000\u4ee5\u4e0b\u3092\u8ffd\u8a18<br \/>\n\u3000[cpu_by_process]<br \/>\n\u3000user root<\/p>\n<p><strong>\u30fb\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u6709\u52b9\u306b\u3059\u308b<\/strong><br \/>\n\u3000# cd \/etc\/munin\/plugins<br \/>\n\u3000# ln -s \/usr\/share\/munin\/plugins\/cpubyuser cpubyuser<br \/>\n\u3000# ln -s \/usr\/share\/munin\/plugins\/cpu_by_process cpu_by_process<\/p>\n<p><strong>\u30fb\u30c7\u30fc\u30bf\u53d6\u5f97\u3067\u304d\u3066\u3044\u308b\u304b\u52d5\u4f5c\u78ba\u8a8d\u3059\u308b<\/strong><br \/>\n\u3000# \/usr\/sbin\/munin-run -servicedir \/etc\/munin\/plugins cpubyuser<br \/>\n\u3000# \/usr\/sbin\/munin-run -servicedir \/etc\/munin\/plugins cpu_by_process<\/p>\n<p><strong>\u30fb\u8a2d\u5b9a\u3092\u6709\u52b9\u306b\u3059\u308b<\/strong><br \/>\n\u3000# service munin-node restart<\/p>\n","protected":false},"excerpt":{"rendered":"<p>mysql\u306e\u969c\u5bb3\u3092\u76e3\u8996\u3059\u308b\u5404\u7a2e\u8a2d\u5b9a\u30e1\u30e2 \u3000mysql\u304c\u904e\u8ca0\u8377\u306b\u306a\u308b\u73fe\u8c61\u304c\u78ba\u8a8d\u3055\u308c\u305f\u306e\u3067\u3001\u969c\u5bb3\u5bfe\u5fdc\u3068\u76e3\u8996\u3092\u5f37\u5316\u3059\u308b\u305f\u3081\u306b\u884c\u3063\u305f\u4f5c\u696d\u306e\u30e1\u30e2\u3002 \u25a0munin\u306b\u3088\u308b\u76e3\u8996\u306e\u8ffd\u52a0 \u30fbmunin\u306f\u5c0e\u5165\u6e08\u307f\u306e\u60f3\u5b9a \u3000\/usr\/share &hellip; <a href=\"https:\/\/blog.isnext.net\/issy\/archives\/1630\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;mysql\u306e\u969c\u5bb3\u3092\u76e3\u8996\u3059\u308b\u5404\u7a2e\u8a2d\u5b9a\u30e1\u30e2&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[28,24,123],"class_list":["post-1630","post","type-post","status-publish","format-standard","hentry","category-linux","tag-munin","tag-mysql","tag-scientific"],"_links":{"self":[{"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/posts\/1630","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/comments?post=1630"}],"version-history":[{"count":4,"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/posts\/1630\/revisions"}],"predecessor-version":[{"id":1634,"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/posts\/1630\/revisions\/1634"}],"wp:attachment":[{"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/media?parent=1630"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/categories?post=1630"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/tags?post=1630"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}