2017-01-01ãã1å¹´éã®è¨äºä¸è¦§
ãã®è¨äºã¯MySQL Casual Advent Calendar 2017 - Qiitaã®9æ¥ç®ã®ã¨ã³ããªã¨ãªãã¾ãã å®è¡ãé·å¼ããSELECTæãå¼·å¶çµäºãããã¤ã¼ã MySQL5.6ã¾ã§ãæ£å¸¸ã«å¦çãé²ãã§ãã¦é ãSELECTãã¿ã¤ã ã¢ã¦ããããã·ã¹ãã å¤æ°ã¯ããã¾ããã§ããã æ£å¸¸ã«å¦çãé²â¦
ãã®è¨äºã¯MySQL Casual Advent Calendar 2017 - Qiitaã®5æ¥ç®ã®ã¨ã³ããªã¨ãªãã¾ãã ã¿ããªã ããããå°ãã®ãã¢ã¬ã§ãã Oracleã ã¨ãORA-03113:éä¿¡ãã£ãã«ã§ãã¡ã¤ã«ã®çµãããæ¤åºããã¾ããããã£ã¦ãããé ·ãæ¥æ¬èª*1ã§æåãªã¤ãããããã©ãMySQLâ¦
ãã®è¨äºã¯MySQL Casual Advent Calendar 2017 - Qiitaã®2æ¥ç®ã®ã¨ã³ããªã¨ãªãã¾ãã ãã£ãããåæ MySQL8.0ãã¾ã RCã®ç¶æ ã ãã©ãè²ã ãªæ©è½è¿½å ã®è©±é¡ãçãä¸ãã£ã¦ããä¸ã§ã®Advent Calendarã§ãããã®ã§ãMySQL 8.0æ°æ©è½æ¤è¨¼ãªãã¿ãæä¸ãã¦ããâ¦
ä»æ´MySQL5.7ãæ±ãã«ããã£ã¦ MySQL5.6ã¨MySQL5.7ã®ãã©ã¡ã¼ã¿å·®åãããããã¦è¦ç´ãã¦ããããshow_compatibility_56ãã¨ããããããã¯ãã®ã¢ã¼ã移è¡æéã«ãããã¡ãªãããã«ãããªååã®ãã©ã¡ã¼ã¿ãããã¾ãã¦ã ããã¯ä½ï¼ ãSHOW [GLOBAL] STATUSâ¦
ãã¼ãã«ã®è¤è£½ã®ã¨ãããä¸è©±ã«ãªãã¾ãã ã¡ãã£ã¨ããããã¯ã¢ããç®çããæ¤è¨¼ä½æ¥ç¨ã«ãã¼ãã«ãè¤è£½ããã·ã¼ã³ã¯ããããã¾ãã MySQLã§ã¯ããã¼ãã«ã®è¤è£½ã®ããã®ã³ãã³ãã大ãã2種é¡ããã®ã§ããã®éãã確ãããçµæã®ã話ã§ãã CREATE TABLE â¦
ä»æ´ãªãããåãã¦EPUBã®é»åæ¸ç±ãè²·ã£ã¦ã¿ããã§ãã ç´åã®ã¨ã³ããªã§ä¸ãããAmazon Web Servicesè² è·è©¦é¨å ¥éããèªãã«ããã£ã¦ã éå»ã«ãO'Reilly Japan Ebook Storeãã§PDFé»åæ¸ç±ãè²·ã£ããã¨ã¯ããã¾ããããEPUBã¯è²·ã£ããã¨ãããã¾ããã§ãâ¦
ã¾ãã«T/Oãªãã ã AWSè² è·æ¬ããAWSã§ä½ãã·ã¹ãã è² è·è©¦é¨ã®ããæ¹ãã¨ããIssueãæãä¸ããã ãã§ãè²´éãªã®ã ããããããæ®éã«è² è·è©¦é¨ã«ã¤ãã¦ãã£ãã解説ããæ¸ç±èªä½ãã¬ã¢ãªã®ã§ãäºéã«ç¾å³ãããâ atsuizo (@atsuizo) 2017å¹´9æ25æ¥ AWSæ¬ã§ã¯â¦
atsuizo.hatenadiary.jpã®éã«æ±ã£ã¦ããLogstashã§ããããã®æ使ç¨ãããã¡ã¤ã«ã¨ã¯å¥ã®ãã¡ã¤ã«ãåãè¾¼ããã¨ãã¦ãããã¾ãããä½ãåå ãªã®ããã°ããè¦ãã«ãããã¨ãããã¨ãããããã¡ãã«è¨é²ãæ®ãã¦ããã¾ãã ãæå®ãããã¡ã¤ã«ã¸ã®ã¢ã¯ã»ã¹æ¨©â¦
æå±ãã¦ããä¼ç¤¾ã¯å°ããããããããå®ç¸¾ã®ããä¸éããæ¡ç¨ãã¦ããªãã®ã§ãLinuxå ¥éè ãç¸æã«ããæ©ä¼ã¯ãããããªãã§ãã ãªã®ã§ãããã§å ãã¦ãããã¨ã«ãã¾ãã ãæ°ããLinuxã®æç§æ¸ãããã¯ããæ¬ã ã æ°åSEåãç ä¿®ï¼ç¹ã«æç³»ãæ¡ç¨ãã¦ããâ¦
mysqlã¯ã©ã¤ã¢ã³ãããå®æå®è¡ãã¦ãããè¨ç®ã¯å¥éãã£ã¦ãã SHOW [GLOBAL ]STATUSã§åããã®ã¯ãããµã¼ãã¼èµ·åããã®ç´¯ç©å¤ãã¾ãã¯ãã³ãã³ãçºè¡æã®ç¬éå¤ãã¨ããä»æ§ã®ãããåè ã«ã¤ãã¦æ¨ç§»ãç¥ãããã¨ãã¯ã ã»å®ééã§ã³ãã³ãçºè¡ãã¦ãã¡ã¤â¦
Kibanaãç«ã¦ã¦ã¿ã - ãªãããªLifeã«ã¦å½åäºå®ãã¦ãããã®å ¨é¨ã¯è¨äºåã§ããªãã£ãã®ã§ãããä¸æ¦ç· ãããã¦ããã ããã¨æãã¾ãã 以ä¸ãã¼ãã¯ãéã«åããªãã£ãã®ã§å¾ã»ã© Amazon Elasticsearché£æº AWSå¥ç´ãã¦ãããã¸ã¡ã³ãã³ã³ã½ã¼ã«ããAmazonâ¦
ãã¡ã¤ã«ã§ã¯ãªãDBã®ä¸èº«ãåå¾ ããã¾ã§ãLogstashãfluentdããããã¡ã¤ã«ããèªã¿è¾¼ãã§elasticsearchã«æµãè¾¼ãäºä¾ãæ±ã£ã¦ãã¾ããããã©ã¡ãããããã¼ã¿ãã¼ã¹ãããç´æ¥èªã¿åã£ã¦ãelasticsearchã«æµãè¾¼ããã¨ãã§ãã¾ãã ä»åã¯ãMySQLã®ä¸èº«â¦
Embulkã¨ã¯ ãFruentdã®ãããçãã¨å¼ã°ãããã¨ãå¤ããã¼ã«ã§ãFruentdãLogstashãé次çæããããã¼ã¿ãã¹ããªã¼ã ã¨ãã¦æ±ã£ã¦è»¢éããã®ã«å¯¾ããEmbulkã¯ã»ã¼å¤åã®ãªããã¼ã¿ã®å¡ã転éããã®ã«åãã¦ããã¨ã¼ã¸ã§ã³ããã¨ããä½ç½®ä»ãã«ãªãã¾ããâ¦
fluentdã¨ã¯ å¥åãtd-agentãã§ãããã¨ãããããããã«ãTresure Dataã®ããã³ãã¨ãªããã°åéã¨ã¼ã¸ã§ã³ãã¨ããä½ç½®ä»ãã§ããããã¯ãæ§ã ãªãã©ã°ã¤ã³ãéãã¦æè»ãªå¦çãå¯è½ã¨ãªã£ã¦ããããã¨æ¥æ¬ã«ããã¦ã¯ããã°åé管çã®ã¨ã¼ã¸ã§ã³ãã¨ãã¦Lâ¦
Logstashã¨ã¯ ãã¾ãã¾ãªãã¼ã¿ã½ã¼ã¹ããæ å ±ãåéãããã¾ãã¾ãªstashï¼æ ¼ç´åº«ã«ãã¼ã¿ãæå ¥ããæ©è½ãæä¾ãããã¼ã«ã§ãã Elaticsearchã®æèã§èªãä¸ã§ã¯ããElasticsearchã«ãã¼ã¿ãæå ¥ããããã®ã¨ã¼ã¸ã§ã³ããã¨ããä½ç½®ä»ãã«ãªãã¾ãããLogstâ¦
Filebeatã¨ã¯ beatãã¤ã³ã¹ãã¼ã«ãããã·ã³ä¸ã®ãã¡ã¤ã«ãç£è¦ãããã®å 容ãåéããbeatã§ãã ããããä¸è¬çãªãã°ãã¡ã¤ã«ç£è¦ã»åéãã¼ã«ã¨ããä½ç½®ä»ãã§ãããsyslogãApache2ãnginxãmysqlã«ã¤ãã¦ã¯elasticsearchã®ã¤ã³ããã¯ã¹çæãã³ãã¬ã¼â¦
Packetbeatã¨ã¯ beatãã¤ã³ã¹ãã¼ã«ãããã·ã³ã®ãããã¯ã¼ã¯ã»ã¤ã³ã¿ã¼ãã§ã¼ã¹ãç£è¦ãããã®å 容ãåéããbeatã§ãã ãããã¯ã¼ã¯ãã±ããã®å 容ã¯ããããã³ã«æ¯ã«æ´çããã¾ãã ä»åããã·ã¹ãã ä¸è¬ã¨MySQLã®æ å ±ãåå¾ãããã¨ãç®çã¨ãã¦ãã¾ãâ¦
Metricbeatã¨ã¯ ã·ã¹ãã ã®çµ±è¨æ å ±ï¼Metricï¼ãåéããbeatã§ãã ããããOSã§åå¾ã§ããCPUãã¡ã¢ãªãªã©ã®æ å ±ãããã³ãã¢ã¸ã¥ã¼ã«ãéãã¦ApacheãMySQLãã®ä»ã®çµ±è¨æ å ±ããã¡ãã£ã¨ããè¨å®ãããã ãã§åéã§ããæ§ã«ãªã£ã¦ãã¾ãã ä»åã¯ãSystemâ¦
ãã¼ã¿åéã®å éãã©ãããã æ¦è¦ã®ã¨ããã§èª¬æããã¨ãããã¨ã¼ã¸ã§ã³ãçµç±ã§Elasticsearchã«æ å ±ãåéããã®ã§ãããé¸æè¢ãçµæ§å¤ãã§ããã ããããäºä¾ãè¨äºã ã¨ãæ¥æ¬ã§ã¯Fluentdãå§åçã«å¤ãã¦ã次ã«Logstashã FluentdãLogstashãããã¡â¦
ã¾ãã¯å¨ãç¨æãã Kibanaã使ãã«ã¯ãåæã»å¯è¦å対象ã®ãã¼ã¿ãå ¥ããå¨ã¨ãã¦ã®Elasticsearchãç«ã¦ããããåç §ãããããã«Kibanaãç«ã¦ãã¾ããå¨ã«ãã¼ã¿ãå ¥ããä»çµã¿ãç¨æãããã¨ããé çªã§é²ãã§ããã¾ãããã£ã¦ãããã§ã¯ãå¨ã¨ãã¦ã®Elastâ¦
å¤ããè¦ãKibana www.elastic.coããã£ããã¨ãã¦ãã¾ãããè¦ã¯ãªã¼ãã³ã½ã¼ã¹ã®ãã°ãã¼ã¿è§£æ/å¯è¦åãã¼ã«ã§ããåºæ¬çã«ããªã¢ã«ã¿ã¤ã æ¤ç´¢ã¨ã³ã¸ã³ãElasticsearchãã¨ã»ããã§ä½¿ããã¾ãã ç¬èªã®Node.js Webãµã¼ãã¼ãä»ãã¦ãããã¨ãããã¨ã§ãå¥â¦
ãã£ãã ãªããKibanaãæµè¡ã£ã¦ããã¿ãããªã®ã§ãä»æ´æã¯ããã¾ãããã¨ããããããã£ã¦ã¿ããã¨ã«ãã¾ããã å¤åãAWSã§ãã«ããã¼ã¸ãã«ãã¾ããã®æ¹ãã©ã¯ãã³ãªãã ãããªã¼ãã¨æãã¤ã¤ãRDSã¨åæ§ããã¼ã«ã«ã«ãã®ã¾ãã¾ç«ã¦ã¦ã¤ãã¤ãæ¯è¼ããâ¦
ã ãã¶åã«ä¸ããã¨ã³ããªã®å½±é¿ã§ãLANé¢ä¿ã®ãè²·ãä¸ãããããã観測ãããå¼ããã°ã§ãã atsuizo.hatenadiary.jpã¨ã³ããªèªä½ã3å¹´åã£ã¦ã®ãé©ãã§ããããã®é¶ç´°ããã°ã§ãä»ãæã«æ°åã¯ãè²·ä¸ãé ãã¦ãã模æ§ã 詳ãã調ã¹ã¦ãªãããã©ãéé¡ã§ã¯â¦
ã ãããã®ãã¨ã¯ããããã«æ¸ãã¦ãã Javaèªä½ããã§ã«æ´å²ããæè¡ã§ãããä»åã®OutOfMemoryErrorãããã®è§£ææ¹æ³ã確ç«ããã¦ããããã§ããããã§ããªãã®æ å ±ãæã«å ¥ãã10å¹´ãããåãJava1.4ã®æ¡ä»¶ã§ã¡ãã£ã¨ã³ã¼ãæ¸ããç¨åº¦ã«ããJavaã¨æ¥ç¹ã®â¦
RDSã®ãstopãããµãã¼ãããã¾ããã AWS Relational Database Serviceï¼ä»¥ä¸RDSï¼ã¯ãããããDatabase as a serviceã§ãEC2ã¨ã¯éããã¤ã³ã¹ã¿ã³ã¹ã®Stop/Startãåºæ¥ããåæ¢ã»èµ·åã«ç¸å½ããã®ã¯Terminateï¼æçµã¹ãããã·ã§ãããåå¾ãã¦ãã¤ã³ã¹ã¿ã³â¦
ãã°ããããã°ã¨ã³ããªããã¦ã¾ããã§ããããå¼ãç¶ãMySQLé¢ä¿ã®ãä»äºãã¦ããã®ã§ã復活弾ããã£ã±ãMySQLãã¿ã§ãã ãããã ãmetadata lockã£ã¦ä½ãï¼ã ã¨ã ãWaiting for Table metadata lockã§ããã£ããã©ããããè¯ãã®ï¼ã ã£ã¦è©±ã¯ãéå»ã«â¦
èªåã§ãã£ãå ´åã®æé ãæ³åãã ãã®ã¨ããå¿ è¦ã«ãªãæ å ±ãåææ¡ä»¶ãå®äºæ¡ä»¶ãä½ãã¯ã£ãããããã ã©ããããã®æéãæãããããè¦ç©ããã ãããçãã«ãã㨠ä¾é ¼ã®éã«è¢«ä¾é ¼äººã¨ã®èª¿æ´ã«å¿ è¦ä»¥ä¸ã«æéãããã 被ä¾é ¼äººã®ä½æ¥ãæ»ã 被ä¾é ¼â¦
timeoutç³»ãã©ã¡ã¼ã¿ã¯ããã¤ãããããã© æ°è¦æ¥ç¶æã®ã¿ã¤ã ã¢ã¦ãï¼connect_timeoutï¼ã§ã¯ãªããä¸åº¦ç¢ºç«ããæ¥ç¶ãã¿ã¤ã ã¢ã¦ãã§åæãããç¾è±¡ã«å½±é¿ããã¿ã¤ã ã¢ã¦ãè¨å®ã®ã話ã ERROR 2013 (HY000): Lost connection to MySQL server during queryâ¦
å æ¥ããã®è¨äºãå ¬éããã¦ããã®ã§ gihyo.jp ã¢ã¬ï¼ã£ã¦æã£ã¦ããã¥ã¡ã³ãè¦ç´ãã¦ãæå ã®ç°å¢ã§ãå®è¡ãã¦ã¿ã¾ããã 確ãã«ããã®éããã ã£ãã®ã ãã©ãããã¥ã¡ã³ãã«æ¸ãã¦ããã¨ããã®ãã¨ããã¤ãããã®ä¸é¨ãã®è©±ã ãªã¼ã¨ããã£ãã®ã§ãããã¡ãâ¦
ãã¼ãPCã®èååã®å½±é¿ã§ æç·LANãã¼ããç¡ãæ©ç¨®ãå¢ãã¦ã¾ããããã¯ã©ã ã·ã§ã«ã2-in-1ã®æãããã¿ã¿ã¤ããã»ãã¬ã¼ãã¿ã¤ããªã©ãèãã追æ±ãããã¶ã¤ã³ãæ±ããå¾åã«æè»ãããã£ã¦ãã¾ããMacBookã¿ããã«ãUSB TypeCãã ããã¿ãããªå°ã£ãã¤ãâ¦