{"id":3206,"date":"2015-12-10T09:42:48","date_gmt":"2015-12-10T00:42:48","guid":{"rendered":"http:\/\/www.skyarch.net\/blog\/?p=3206"},"modified":"2015-12-10T09:46:35","modified_gmt":"2015-12-10T00:46:35","slug":"lamp-%e7%92%b0%e5%a2%83%e3%83%81%e3%83%a5%e3%83%bc%e3%83%8b%e3%83%b3%e3%82%b0%e3%81%ab%e4%be%bf%e5%88%a9%e3%81%aa%e3%83%84%e3%83%bc%e3%83%ab-2","status":"publish","type":"post","link":"https:\/\/www.skyarch.net\/blog\/lamp-%e7%92%b0%e5%a2%83%e3%83%81%e3%83%a5%e3%83%bc%e3%83%8b%e3%83%b3%e3%82%b0%e3%81%ab%e4%be%bf%e5%88%a9%e3%81%aa%e3%83%84%e3%83%bc%e3%83%ab-2\/","title":{"rendered":"LAMP \u74b0\u5883\u30c1\u30e5\u30fc\u30cb\u30f3\u30b0\u306b\u4fbf\u5229\u306a\u30c4\u30fc\u30eb \u2013 2"},"content":{"rendered":"<p>LAMP \u74b0\u5883\u30c1\u30e5\u30fc\u30cb\u30f3\u30b0\u306b\u4fbf\u5229\u306a\u30c4\u30fc\u30eb\u7b2c\u4e8c\u5f3e\u306f MySQL \u306b\u95a2\u3057\u3066\u306e\u30c4\u30fc\u30eb\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<br \/>\n\u305d\u306e\u540d\u3082 <strong><span style=\"color: #ff0000;\">mytop<\/span><\/strong> !!<br \/>\n\u524d\u56de\u3001apachetop \u3092\u3054\u7d39\u4ecb\u3057\u307e\u3057\u305f\u304c\u3001\u540c\u3058\u3088\u3046\u306b top \u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30af\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002<br \/>\n\u3055\u3066\u3001mytop \u3067\u306f\u4f55\u3092\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u3067\u78ba\u8a8d\u3067\u304d\u308b\u306e\u3067\u3057\u3087\u3046\u304b ( ^\u03c9^)\u30ef\u30af\u30ef\u30af<br \/>\n\u3068\u308a\u3042\u3048\u305a epel \u306b\u63a2\u3057\u306b\u884c\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# yum install mytop --eneblerepo=epel\r\n<\/pre>\n<p>\u666e\u901a\u306b\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u767a\u898b\u3002\u304a\u3082\u3080\u308d\u306b mytop \u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n&#x5B;root@mytop ~]# mytop\r\nCannot connect to MySQL server. Please check the:\r\n\r\n* database you specified &quot;test&quot; (default is &quot;test&quot;)\r\n* username you specified &quot;root&quot; (default is &quot;root&quot;)\r\n* password you specified &quot;&quot; (default is &quot;&quot;)\r\n* hostname you specified &quot;localhost&quot; (default is &quot;localhost&quot;)\r\n* port you specified &quot;3306&quot; (default is 3306)\r\n* socket you specified &quot;&quot; (default is &quot;&quot;)\r\n\r\nThe options my be specified on the command-line or in a ~\/.mytop\r\nconfig file. See the manual (perldoc mytop) for details.\r\n\r\nHere's the exact error from DBI. It might help you debug:\r\n\r\nAccess denied for user 'root'@'localhost' (using password: NO)\r\n\r\n&#x5B;root@mytop ~]#\r\n<\/pre>\n<p>\u306f\u3044\u3001\u3082\u3061\u308d\u3093\u8a8d\u8a3c\u3067\u3072\u3063\u304b\u304b\u308a\u307e\u3059\u306d\u3002\u306a\u306b\u3084\u3089\u3001\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u7528\u610f\u3059\u308c\u3070\u8a8d\u8a3c\u90e8\u5206\u3092\u77ed\u7e2e\u3067\u304d\u305d\u3046\u306a\u611f\u3058\u304c\u51fa\u3066\u307e\u3059\u3002<br \/>\n\u3067\u306f man \u3067\u78ba\u8a8d\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# man mytop\r\n<\/pre>\n<p>\u65e9\u901f\u6c17\u306b\u306a\u308b\u8a18\u8ff0\u3092\u767a\u898b ( ^\u03c9^)b<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nConfig File\r\n\r\nInstead of always using bulky command-line parameters, you can also use a config file in your home directory (&quot;~\/.mytop&quot;). If present, mytop will read it automatically. It is read before any of\r\nyour command-line arguments are processed, so your command-line arguments will override directives in the config file.\r\n\r\nHere is a sample config file &quot;~\/.mytop&quot; which implements the defaults described above.\r\n\r\nuser=root\r\npass=\r\nhost=localhost\r\ndb=test\r\ndelay=5\r\nport=3306\r\nsocket=\r\nbatchmode=0\r\nheader=1\r\ncolor=1\r\nidle=1\r\n\r\nUsing a config file will help to ensure that your database password isn\u2019t visible to users on the command-line. Just make sure that the permissions on &quot;~\/.mytop&quot; are such that others cannot read\r\nit (unless you want them to, of course).\r\n\r\nYou may have white space on either side of the &quot;=&quot; in lines of the config file.\r\n<\/pre>\n<p>\u3053\u308c\u306f\u30ed\u30b0\u30a4\u30f3\u60c5\u5831\u306e\u5165\u529b\u3092\u77ed\u7e2e\u3057\u3066\u304f\u308c\u305d\u3046 ( ^\u03c9^)b<br \/>\nhome \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b .mytop \u3068\u3044\u3046\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u7f6e\u3051\u3070\u30a2\u30ab\u30a6\u30f3\u30c8\u60c5\u5831\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u306a\u3069\u56fa\u5b9a\u3067\u304d\u308b\u3088\u3046\u3067\u3059\u3002<br \/>\n(\u304b\u3064\u30d1\u30b9\u30ef\u30fc\u30c9\u304c\u30ed\u30b0\u306b\u6b8b\u308b\u306e\u3092\u9632\u304e\u307e\u3059\u3002)<br \/>\n\u307e\u305a\u306f\u7c21\u5358\u306b\u4ee5\u4e0b\u3092\u5165\u529b\u3057\u3066\u4fdd\u5b58\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# vim \/root\/.mytop\r\n\r\nuser=root\r\npass=xxxxxxxxx\r\nhost=localhost\r\n<\/pre>\n<p>\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u8a18\u8f09\u3092\u3059\u308b\u306e\u3067\u3001\u30d5\u30a1\u30a4\u30eb\u6a29\u9650\u3092\u5909\u3048\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# chmod 600 \/root\/.mytop\r\n<\/pre>\n<p>\u305d\u306e\u307b\u304b\u306e\u9805\u76ee\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u304c\u3042\u308b\u3068\u4fe1\u3058\u3066\u3001\u30e6\u30fc\u30b6\u30fc\u540d\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u3001\u63a5\u7d9a\u5148\u306e\u307f\u8a18\u8f09\u3057\u3066\u3001\u3044\u3056 mytop !!<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# mytop\r\n<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nMySQL on localhost (5.5.19-log) up 0+05:36:49 &#x5B;19:18:58]\r\nQueries: 1.8M qps: 91 Slow: 0.0 Se\/In\/Up\/De(%): 81\/01\/00\/00\r\nqps now: 69 Slow qps: 0.0 Threads: 11 ( 1\/ 3) 77\/01\/01\/00\r\nCache Hits: 950.6k Hits\/s: 48.2 Hits now: 29.6 Ratio: 65.1% Ratio now: 55.8%\r\nKey Efficiency: 98.4% Bps in\/out: 19.5k\/443.7k Now in\/out: 18.0k\/29.7k\r\n\r\nId User Host\/IP DB Time Cmd Query or State\r\n-- ---- ------- -- ---- --- ----------\r\n78886 root localhost test 0 Query show full processlist\r\n78929 mytop.user ec2-xxx mytop_db 1 Sleep\r\n78930 mytop.user ec2-xxx mytop_db 1 Sleep\r\n78933 mytop.user ec2-xxx mytop_db 1 Sleep\r\n78934 mytop.user ec2-xxx mytop_db 1 Sleep\r\n78926 mytop.user ec2-xxx mytop_db 1 Sleep\r\n<\/pre>\n<p>\u304a\uff5e\uff01\uff01\u30af\u30a8\u30ea\u304c\u4e38\u898b\u3048\u3067\u3059\u3002\u53f3\u4e0a\u306b show full processlist \u3068\u8a18\u8f09\u304c\u3042\u308a\u307e\u3059\u306d\u3002<br \/>\n\u6570\u5024\u306e\u8a73\u7d30\u306f\u4e0b\u8a18\u306e\u901a\u308a\u3002\u69d8\u3005\u306a\u7d71\u8a08\u60c5\u5831\u304c\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u3067\u8a08\u6e2c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Queries<\/strong>: mysqld\u8d77\u52d5\u6642\u304b\u3089\u306e\u7dcf\u30af\u30a8\u30ea\u6570<br \/>\n<strong>qps<\/strong>: mysqld\u8d77\u52d5\u6642\u304b\u3089\u306e\u5e73\u5747\u79d2\u9593\u30af\u30a8\u30ea\u6570( Queries Per Second )<br \/>\n<strong>Slow<\/strong>: mysqld\u8d77\u52d5\u6642\u304b\u3089\u306e\u7dcf\u30b9\u30ed\u30fc\u30af\u30a8\u30ea\u6570<br \/>\n<strong>Se\/In\/Up\/De(%)<\/strong>: \u5404\u30af\u30a8\u30ea\u306e\u6bd4\u7387\uff08 Alter\u6587\u3084Create\u6587\u306a\u3069\u3082\u542b\u3081\u305f\u30d1\u30fc\u30bb\u30f3\u30c6\u30fc\u30b8\u306e\u305f\u3081\u3001\u5408\u8a08\u306f100\uff05\u306b\u306a\u308a\u307e\u305b\u3093\u3000\uff09<br \/>\n<strong>Se<\/strong>: Select\u6587<br \/>\n<strong>In<\/strong>: Insert\u6587<br \/>\n<strong>Up<\/strong>: Update\u6587<br \/>\n<strong>De<\/strong>: Delete\u6587<br \/>\n<strong>qps now<\/strong>: \u89b3\u6e2c\u6642\u306eqps *2<br \/>\n<strong>Slow qps<\/strong>: \u89b3\u6e2c\u6642\u306e\u30b9\u30ed\u30fc\u30af\u30a8\u30ea\u306eqps<br \/>\n<strong>Threads<\/strong>: \u5b9f\u884c\u4e2d\u306e\u30b9\u30ec\u30c3\u30c9\u6570\u00a0[\u30a2\u30af\u30c6\u30a3\u30d6\u30b9\u30ec\u30c3\u30c9\u6570] \/ [\u7dcf\u30b9\u30ec\u30c3\u30c9\u30ad\u30e3\u30c3\u30b7\u30e5\u6570]\n<strong>Key Efficiency<\/strong>: key_buffer\uff08\uff4d\uff59ISAM\uff09\u306e\u30d2\u30c3\u30c8\u7387 *3<br \/>\n<strong>Bps in\/out<\/strong>: \u30c7\u30fc\u30bf\u8ee2\u9001\u901f\u5ea6\uff08\u7d2f\u7a4d\u5e73\u5747\uff09[Bytes\/sec]\n<strong>Now in\/out<\/strong>: \u30c7\u30fc\u30bf\u8ee2\u9001\u91cf\uff08\u89b3\u6e2c\u6642\uff09[bits\/sec]\n<p>&nbsp;<\/p>\n<p>\u307e\u305f\u3001\u30b3\u30de\u30f3\u30c9\u5b9f\u884c\u4e2d\u306b\u8868\u793a\u306e\u5207\u308a\u66ff\u3048\u3084\u3001\u8868\u793a\u5bfe\u8c61\u306e\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u3082\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<p><strong>- \u5236\u5fa1\u7cfb<\/strong><\/p>\n<p>?: \u30d8\u30eb\u30d7\u60c5\u5831\u3092\u8868\u793a\u3057\u307e\u3059<br \/>\nk: \u30b9\u30ec\u30c3\u30c9\u3092\u505c\u6b62\u3057\u307e\u3059 ( \u3053\u308c\u6016\u3044\u3067\u3059\u306d\u3002\u3002)<br \/>\np: \u8868\u793a\u306e\u4e00\u6642\u505c\u6b62\u3092\u3057\u307e\u3059<br \/>\nq: mytop \u30b3\u30de\u30f3\u30c9\u3092\u7d42\u4e86\u3057\u307e\u3059<br \/>\nr: \u4e00\u90e8\u7d71\u8a08\u60c5\u5831\u306e\u30ea\u30bb\u30c3\u30c8\uff08 Queries \u306a\u3069\u4e00\u90e8\u306e\u60c5\u5831\u306f\u30ea\u30bb\u30c3\u30c8\u3055\u308c\u306a\u3044 \uff09<br \/>\ns: \u66f4\u65b0\u306e\u9593\u9694\u3092\u8a2d\u5b9a\u3057\u307e\u3059 ( \u79d2\u5358\u4f4d \u30c7\u30d5\u30a9\u30eb\u30c8 5\u79d2 \uff09<\/p>\n<p><strong>- \u30d5\u30a3\u30eb\u30bf\u30fc\u7cfb<\/strong><\/p>\n<p>d: \u7279\u5b9a\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3078\u306e\u63a5\u7d9a\u306e\u307f\u8868\u793a\u3057\u307e\u3059<br \/>\nh: \u7279\u5b9a\u30db\u30b9\u30c8\u304b\u3089\u306e\u63a5\u7d9a\u306e\u307f\u8868\u793a\u3057\u307e\u3059<br \/>\ni: \u5b9f\u884c\u4e2d\u306e\u30b9\u30ec\u30c3\u30c9\u306e\u307f\u8868\u793a\u3057\u307e\u3059<br \/>\no: \u5b9f\u884c\u6642\u9593\u306e\u591a\u3044\u9806\u306b\u8868\u793a\u3057\u307e\u3059\uff08 \u3082\u3046\u4e00\u5ea6 o \u30b3\u30de\u30f3\u30c9\u767a\u884c\u3059\u308b\u3068\u5143\u306b\u623b\u308a\u307e\u3059 \uff09<br \/>\nu: \u7279\u5b9a\u30e6\u30fc\u30b6\u306e\u30b9\u30ec\u30c3\u30c9\u306e\u307f\u8868\u793a\u3057\u307e\u3059<br \/>\nF: \u30d5\u30a3\u30eb\u30bf\u8a2d\u5b9a\u3092\u89e3\u9664\u3057\u307e\u3059<\/p>\n<p><strong>- \u8868\u793a\u30e2\u30fc\u30c9\u5207\u66ff\u3048<\/strong><\/p>\n<p>c: mysql \u30b3\u30de\u30f3\u30c9\u306e\u7d2f\u7a4d\u5b9f\u884c\u6bd4\u7387\u3092\u8868\u793a\u3057\u307e\u3059<br \/>\nm: qps \u60c5\u5831\u306e\u307f\u3092\u8868\u793a\u3057\u307e\u3059<br \/>\nt: \u30c7\u30d5\u30a9\u30eb\u30c8\u30e2\u30fc\u30c9\u306b\u623b\u3057\u307e\u3059<br \/>\nH: \u30d8\u30c3\u30c0\u30fc\u90e8\u5206\u3092\u975e\u8868\u793a\u306b\u3057\u307e\u3059<br \/>\nI: InnoDB \u306e\u7d71\u8a08\u60c5\u5831\u3092\u8868\u793a\u3057\u307e\u3059<\/p>\n<p><strong>- \u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u30c1\u30e5\u30fc\u30cb\u30f3\u30b0\u6642\u306b\u4f7f\u3048\u305d\u3046<\/strong><\/p>\n<p>e: \u30af\u30a8\u30ea\u306e Explain \u7d50\u679c\u3092\u8868\u793a\u3057\u307e\u3059<br \/>\nf: \u7279\u5b9a\u306e\u30b9\u30ec\u30c3\u30c9\u306b\u3066\u5b9f\u884c\u3055\u308c\u308b\u30af\u30a8\u30ea\u3092\u5168\u6587\u3067\u8868\u793a\u3057\u307e\u3059<\/p>\n<hr \/>\n<p>MySQL \u3092\u904b\u7528\u3059\u308b\u306b\u3042\u305f\u308a\u3001\u69d8\u3005\u306a\u5834\u9762\u3067\u4f7f\u3048\u305d\u3046\u306a\u30b3\u30de\u30f3\u30c9\u3067\u3059\u304c\u3001\u6ce8\u610f\u70b9\u3082\u3042\u308a\u307e\u3059\u3002<\/p>\n<p><strong><span style=\"text-decoration: underline;\">\u30fb\u8ca0\u8377\u72b6\u6cc1\u306b\u3088\u3063\u3066\u306f\u3001mytop \u306e\u4f7f\u7528\u306f NG<\/span><\/strong><br \/>\n<strong><span style=\"text-decoration: underline;\"> \u30fb\u30b5\u30fc\u30d3\u30b9\u5f71\u97ff\u3092\u4e0e\u3048\u308b\u5236\u5fa1\u7cfb\u30b3\u30de\u30f3\u30c9\u3082\u3042\u308b<\/span><\/strong><br \/>\n\u4ee5\u4e0a\u3092\u8e0f\u307e\u3048\u305f\u70b9\u3067\u3001\u904b\u7528\u306b\u6d3b\u304b\u3057\u3066\u3044\u304d\u305f\u3044\u3067\u3059\u306d\u3002<br \/>\n\u7c21\u5358\u3067\u3057\u305f\u304c\u3001mytop \u306e\u7d39\u4ecb\u3067\u3057\u305f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>LAMP \u74b0\u5883\u30c1\u30e5\u30fc\u30cb\u30f3\u30b0\u306b\u4fbf\u5229\u306a\u30c4\u30fc\u30eb\u7b2c\u4e8c\u5f3e\u306f MySQL \u306b\u95a2\u3057\u3066\u306e\u30c4\u30fc\u30eb\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002 \u305d\u306e\u540d\u3082 mytop !! \u524d\u56de\u3001apachetop \u3092\u3054\u7d39\u4ecb\u3057\u307e\u3057\u305f\u304c\u3001\u540c\u3058\u3088\u3046\u306b top \u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30af\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002 &#8230;<\/p>\n","protected":false},"author":16,"featured_media":2394,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_locale":"ja","_original_post":"3206","footnotes":""},"categories":[24],"tags":[],"class_list":{"0":"post-3206","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-mysql","8":"ja"},"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/posts\/3206","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/comments?post=3206"}],"version-history":[{"count":23,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/posts\/3206\/revisions"}],"predecessor-version":[{"id":5224,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/posts\/3206\/revisions\/5224"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/media\/2394"}],"wp:attachment":[{"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/media?parent=3206"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/categories?post=3206"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/tags?post=3206"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}