
{"id":747,"date":"2012-03-24T06:34:58","date_gmt":"2012-03-23T21:34:58","guid":{"rendered":"http:\/\/a23187.yorozuyah.com\/blog\/?p=747"},"modified":"2014-03-10T19:30:35","modified_gmt":"2014-03-10T10:30:35","slug":"mha%e3%81%a7%e8%87%aa%e5%8b%95%e7%9a%84%e3%81%ab%e3%83%9e%e3%82%b9%e3%82%bf%e3%83%bc%e3%82%92%e5%88%87%e3%82%8a%e6%9b%bf%e3%81%88%e3%82%8b","status":"publish","type":"post","link":"https:\/\/a23187.yorozuyah.com\/blog\/?p=747","title":{"rendered":"MHA\u3092\u4f7f\u3063\u3066\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304b\u3089\u900f\u904e\u7684\u306bMySQL\u306e\u30de\u30b9\u30bf\u30fc\u3092\u5207\u308a\u66ff\u3048\u3066\u307f\u305f"},"content":{"rendered":"<p>DeNA\u3067\u958b\u767a\u3055\u308c\u305f\u3042\u308a\u304c\u305f\u3044\u30c4\u30fc\u30ebMHA\u3092\u62dd\u501f\u3057\u3066\u3001HA\u69cb\u6210\u3092\u4f5c\u3063\u3066\u307f\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u69cb\u6210\u306f<br \/>\ndns01.yorozuyah.local\u3000\u3000DNS\u30b5\u30fc\u30d0\u517cMHA\u30de\u30cd\u30fc\u30b8\u30e3<br \/>\ndb01.yorozuyah.local\u3000\u3000MySQL \u30de\u30b9\u30bf\u30fc<br \/>\ndb02.yorozuyah.local\u3000\u3000MySQL \u30b9\u30ec\u30fc\u30d6\uff11<br \/>\ndb03.yorozuyah.local\u3000\u3000MySQL \u30b9\u30ec\u30fc\u30d6\uff12<br \/>\n\u3068\u3057\u307e\u3059\u3002<\/p>\n<p>DNS\u306f\u969c\u5bb3\u304c\u767a\u751f\u3057\u305f\u3068\u304d\u306b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304b\u3089\u898b\u305f\u30de\u30b9\u30bf\u30fc\u3068\u30b9\u30ec\u30fc\u30d6\u306e\u30db\u30b9\u30c8\u540d\u3092\u5207\u308a\u66ff\u3048\u308b\u3068\u304d\u306b\u4f7f\u3044\u307e\u3059\u3002<br \/>\n\u3042\u3068\u306f\u30b9\u30ec\u30fc\u30d6\u306eDNS\u30e9\u30a6\u30f3\u30c9\u30ed\u30d3\u30f3\u7528\u3068\u3057\u3066\u3002<\/p>\n<p>OS\u306fCentOS 5.5<br \/>\nMySQL\u306f\u30d0\u30f3\u30c9\u30eb\u306e5.0.77\uff08\u53e4\u3044\uff01\uff09<br \/>\nmha\u306f0.53\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<p>\u52dd\u624b\u306b\u30bf\u30a4\u30e0\u30c8\u30e9\u30a4\u30a2\u30eb\u3067\u30b9\u30bf\u30fc\u30c8\u3002<\/p>\n<p>\u624b\u9806\u306f\u304b\u306a\u308a\u306f\u7701\u7565\u3057\u3066\u307e\u3059\u3002<\/p>\n<p><strong>\u30100:00\u3011<\/strong><br \/>\nVirtualBox\u306bCentOS 5.5\u304c\u3053\u308d\u304c\u3063\u3066\u3044\u305f\u306e\u3067\u3001\u30de\u30b9\u30bf\u30fcOS\u3068\u3057\u3066\u69cb\u7bc9\u958b\u59cb\u3002<\/p>\n<p>\u307e\u305a\u306f\u3001MHA\u30de\u30cd\u30fc\u30b8\u30e3\u3068\u30ce\u30fc\u30c9\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002<\/p>\n<p><a href=\"http:\/\/code.google.com\/p\/mysql-master-ha\/downloads\/list\">\u3053\u3061\u3089\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9<\/a><\/p>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306b\u306f\u3044\u304f\u3064\u304b\u306eperl\u30e2\u30b8\u30e5\u30fc\u30eb\u304c\u5fc5\u8981\u3002<\/p>\n<p>\u8ffd\u52a0\u306b\u306fepel\u3092\u4f7f\u7528\u3002<br \/>\nenable=0\u306f\u5fd8\u308c\u306a\u3044\u3088\u3046\u306b\u3002<br \/>\n\u3053\u3093\u306a\u611f\u3058\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/p>\n<div class=\"command\">\n<p>\u30ce\u30fc\u30c9\u306f\u5168\u30b5\u30fc\u30d0\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002CPAN\u3067DBI\u3092\u5165\u308c\u305f\u5834\u5408\u306f\u4f9d\u5b58\u3092\u7121\u8996\u3067\u30b3\u30de\u30f3\u30c9\u5b9f\u884c\u3002<br \/>\n# rpm -Uvh mha4mysql-node-0.53-0.noarch.rpm &#8211;nodeps<\/p>\n<p>\u30de\u30cd\u30fc\u30b8\u30e3\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002\u3053\u3061\u3089\u306fperl\u30e2\u30b8\u30e5\u30fc\u30eb\u304c\u8907\u6570\u5fc5\u8981\u3002rpm\u306f\u4f9d\u5b58\u95a2\u4fc2\u7121\u8996\u3067\u3002<br \/>\n# yum install perl-Config-Tiny.noarch perl-Log-Dispatch.noarch perl-Parallel-ForkManager.noarch &#8211;enablerepo=epel<\/p>\n<p># rpm -Uvh mha4mysql-manager-0.53-0.noarch.rpm &#8211;nodeps<\/p>\n<\/div>\n<div class=\"command\">\n<p>\u7d9a\u3044\u3066bind97\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u3059\u304c\u3001conflict\u3057\u305f\u306e\u3067remove\u3057\u3066\u304b\u3089\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002<\/p>\n<p># yum remove bind-libs<br \/>\n# yum install bind97.i386 bind97-utils.i386<\/p>\n<\/div>\n<p>\u30be\u30fc\u30f3\u30d5\u30a1\u30a4\u30eb\u306f\u3053\u3093\u306a\u611f\u3058\u3067\u3002\u3042\u3093\u307e\u308a\u66f8\u3044\u305f\u3053\u3068\u306a\u3044\u306e\u3067\u6b63\u3057\u3044\u306e\u304b\u4e0d\u660e\u30fb\u30fb\u30fb\u3002<\/p>\n<div class=\"command\">$TTL 1D<br \/>\n@ IN SOA dns01.yorozuyah.local. root.localhost. (<br \/>\n20120323 ; serial<br \/>\n1D ; refresh<br \/>\n1H ; retry<br \/>\n1W ; expire<br \/>\n3H ) ; minimum<br \/>\nIN NS dns01.yorozuyah.local.<br \/>\ndns01 IN A 192.168.0.150<br \/>\ndb01 IN A 192.168.0.151<br \/>\ndb02 IN A 192.168.0.152<br \/>\ndb03 IN A 192.168.0.153; master\u3000\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304b\u3089\u898b\u305f\u30de\u30b9\u30bf\u30fc\u540d<br \/>\ndbm IN A 192.168.0.151<\/p>\n<p>; slave\u3000\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304b\u3089\u898b\u305f\u30b9\u30ec\u30fc\u30d6\u540d<br \/>\ndbs IN A 192.168.0.152<br \/>\ndbs IN A 192.168.0.153<\/p>\n<\/div>\n<p>\u30b9\u30ec\u30fc\u30d6\u306fDNS\u30e9\u30a6\u30f3\u30c9\u30ed\u30d3\u30f3\u3002<\/p>\n<p>named\u7528\u306e\u30d5\u30a1\u30a4\u30eb\u3092root\u3067\u4f5c\u3063\u3066\u3057\u307e\u3063\u3066\u82e5\u5e72\u30cf\u30de\u308b\u304c\u5b8c\u6210\u3002<\/p>\n<p><strong>\u30101:30\u3011<\/strong><br \/>\nMySQL\u30ec\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u3068\u308a\u304b\u304b\u308b\u3002<\/p>\n<p>VirtualBox\u306eClone\u3092\u4f7f\u3046\u306e\u3067\u30de\u30b9\u30bf\u30fc\u3060\u3051\u69cb\u7bc9\u3057\u3066\u3001\u3042\u3068\u306f\u30af\u30ed\u30fc\u30f3\u3092\u30b9\u30ec\u30fc\u30d6\u306b\u3059\u308c\u3070\u3088\u3057\u3002<\/p>\n<p>\u30ec\u30d7\u30ea\u30e6\u30fc\u30b6\u306fMHA\u306e\u5834\u5408\u306f\u5168\u30b5\u30fc\u30d0\u304c\u30de\u30b9\u30bf\u30fc\u306b\u306a\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u306e\u3067\u3001\u30bb\u30b0\u30e1\u30f3\u30c8\u3067\u8a31\u53ef\u3057\u3066\u304a\u3044\u305f\u65b9\u304c\u826f\u3055\u305d\u3046\u3002<\/p>\n<div class=\"command\">\n<p>mysql&gt; GRANT REPLICATION SLAVE ON *.* TO repl@&#8217;192.168.0.%&#8217; IDENTIFIED BY &#8216;replrepl&#8217;;<\/p>\n<\/div>\n<p><strong>\u30101:45\u3011<\/strong><br \/>\n\u80a9\u304c\u3053\u3063\u3066\u304d\u305f\u306e\u3067\u30a8\u30a2\u30b5\u30ed\u30f3\u30d1\u30b9\u3092\u304b\u3051\u3066\u307f\u308b\u3002<br \/>\n\u4ed5\u4e8b\u3067\u306f\u5927\u4f531\u65e5\u306b3\u4e07\u56de\u3001\u30ad\u30fc\u30dc\u30fc\u30c8\u3068\u30de\u30a6\u30b9\u3092\u53e9\u3044\u3066\u3044\u308b\u306e\u3067\u80a9\u304c\u3053\u3063\u3066\u3057\u3087\u3046\u304c\u306a\u3044\u3002<\/p>\n<p>\u3055\u3066\u3001\u30de\u30b9\u30bf\u30fc\u3092\u30b7\u30e3\u30c3\u30c8\u30c0\u30a6\u30f3\u3057\u3066\u3001\u30b9\u30ec\u30fc\u30d62\u3064\u3092\u30af\u30ed\u30fc\u30f3\u304b\u3089\u4f5c\u308b\u3002<\/p>\n<p>2\u3064\u4ee5\u4e0a\u306e\u30bf\u30fc\u30df\u30ca\u30eb\u64cd\u4f5c\u306b\u306fTera Term Pro \u30a2\u30b7\u30b9\u30bf\u30f3\u30c8\u304c\u4fbf\u5229\uff01<br \/>\n<a href=\"http:\/\/www.vector.co.jp\/soft\/win95\/net\/se276622.html\">http:\/\/www.vector.co.jp\/soft\/win95\/net\/se276622.html<\/a><\/p>\n<p>\u3044\u3064\u3082\u306eCHANGE MASTER\u30922\u30b9\u30ec\u30fc\u30d6\u3067\u5b9f\u884c\u3002<\/p>\n<div class=\"command\">mysql&gt; CHANGE MASTER TO<br \/>\nMASTER_HOST=&#8217;db01.yorozuyah.local&#8217;,<br \/>\nMASTER_USER=&#8217;repl&#8217;,<br \/>\nMASTER_PASSWORD=&#8217;replrepl&#8217;,<br \/>\nMASTER_LOG_FILE=&#8217;mysql-bin.000002&#8242;,<br \/>\nMASTER_LOG_POS=4<br \/>\n;mysql&gt; show slave status\\G<br \/>\n*************************** 1. row ***************************<br \/>\nSlave_IO_State: Waiting for master to send event<br \/>\nMaster_Host: db01.yorozuyah.local<br \/>\nMaster_User: repl<br \/>\nMaster_Port: 3306<br \/>\nConnect_Retry: 60<br \/>\nMaster_Log_File: mysql-bin.000002<br \/>\nRead_Master_Log_Pos: 98<br \/>\nRelay_Log_File: mysqld-relay-bin.000002<br \/>\nRelay_Log_Pos: 235<br \/>\nRelay_Master_Log_File: mysql-bin.000002<br \/>\nSlave_IO_Running: Yes<br \/>\nSlave_SQL_Running: Yes<br \/>\nReplicate_Do_DB:<br \/>\n\uff1a<br \/>\n\uff1a<br \/>\n\u3067\u304d\u3066\u307e\u3059\u3002<\/p>\n<\/div>\n<p><strong>\u30102:15\u3011<\/strong><br \/>\nMHA\u3092\u4f7f\u3046\u305f\u3081\u306b\u306f\u5404\u30ce\u30fc\u30c9\u306eroot\u306eSSH\u76f8\u4e92\u30ce\u30f3\u30d1\u30b9\u8a2d\u5b9a\u304c\u5fc5\u8981\u3002<\/p>\n<p><strong>\u30102:30\u3011<\/strong><br \/>\n\u3053\u3053\u304b\u3089MHA\u306e\u8a2d\u5b9a<\/p>\n<p>\u30b3\u30f3\u30d5\u30a3\u30b0\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210<\/p>\n<div class=\"command\"># mkdir \/etc\/conf\/masterha -p<br \/>\n# vi \/etc\/conf\/masterha\/app1.cnf[server default]<br \/>\nuser=root<br \/>\npassword=<br \/>\nssh_user=root<\/p>\n<p>manager_workdir=\/var\/lib\/mysql\/log\/masterha\/app1<br \/>\nremote_workdir=\/var\/lib\/mysql\/log\/masterha\/app1<br \/>\n#\u30d5\u30a7\u30fc\u30eb\u30aa\u30fc\u30d0\u7528\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u66f8\u3044\u3066\u304a\u304f\u2193<br \/>\nmaster_ip_failover_script= \/scripts\/masterha\/master_ip_failover<br \/>\n[server1]<br \/>\nhostname=db01.yorozuyah.local<\/p>\n<p>[server2]<br \/>\nhostname=db02.yorozuyah.local<\/p>\n<p>[server3]<br \/>\nhostname=db03.yorozuyah.local<\/p>\n<p>ssh\u8a2d\u5b9a\u306e\u30c1\u30a7\u30c3\u30af<br \/>\n# masterha_check_ssh &#8211;conf=\/etc\/conf\/masterha\/app1.cnf<br \/>\nSat Mar 24 02:39:23 2012 &#8211; [warning] Global configuration file \/etc\/masterha_default.cnf not found. Skipping.<br \/>\nSat Mar 24 02:39:23 2012 &#8211; [info] Reading application default configurations from \/etc\/conf\/masterha\/app1.cnf..<br \/>\nSat Mar 24 02:39:23 2012 &#8211; [info] Reading server configurations from \/etc\/conf\/masterha\/app1.cnf..<br \/>\nSat Mar 24 02:39:23 2012 &#8211; [info] Starting SSH connection tests..<br \/>\nSat Mar 24 02:39:24 2012 &#8211; [debug]<br \/>\nSat Mar 24 02:39:23 2012 &#8211; [debug] Connecting via SSH from root@db01.yorozuyah.local(192.168.0.151:22) to root@db02.yorozuyah.local(192.168.0.152:22)..<br \/>\nSat Mar 24 02:39:23 2012 &#8211; [debug] ok.<br \/>\nSat Mar 24 02:39:23 2012 &#8211; [debug] Connecting via SSH from root@db01.yorozuyah.local(192.168.0.151:22) to root@db03.yorozuyah.local(192.168.0.153:22)..<br \/>\nSat Mar 24 02:39:24 2012 &#8211; [debug] ok.<br \/>\nSat Mar 24 02:39:25 2012 &#8211; [debug]<br \/>\nSat Mar 24 02:39:24 2012 &#8211; [debug] Connecting via SSH from root@db02.yorozuyah.local(192.168.0.152:22) to root@db01.yorozuyah.local(192.168.0.151:22)..<br \/>\nSat Mar 24 02:39:24 2012 &#8211; [debug] ok.<br \/>\nSat Mar 24 02:39:24 2012 &#8211; [debug] Connecting via SSH from root@db02.yorozuyah.local(192.168.0.152:22) to root@db03.yorozuyah.local(192.168.0.153:22)..<br \/>\nSat Mar 24 02:39:25 2012 &#8211; [debug] ok.<br \/>\nSat Mar 24 02:39:25 2012 &#8211; [debug]<br \/>\nSat Mar 24 02:39:24 2012 &#8211; [debug] Connecting via SSH from root@db03.yorozuyah.local(192.168.0.153:22) to root@db01.yorozuyah.local(192.168.0.151:22)..<br \/>\nSat Mar 24 02:39:25 2012 &#8211; [debug] ok.<br \/>\nSat Mar 24 02:39:25 2012 &#8211; [debug] Connecting via SSH from root@db03.yorozuyah.local(192.168.0.153:22) to root@db02.yorozuyah.local(192.168.0.152:22)..<br \/>\nSat Mar 24 02:39:25 2012 &#8211; [debug] ok.<br \/>\nSat Mar 24 02:39:25 2012 &#8211; [info] All SSH connection tests passed successfully.<br \/>\n\u2191<br \/>\nOK\u307f\u305f\u3044<\/p>\n<\/div>\n<div class=\"command\">MHA\u306e\u30c1\u30a7\u30c3\u30af# masterha_check_repl &#8211;conf=\/etc\/conf\/masterha\/app1.cnf<br \/>\nSat Mar 24 02:40:55 2012 &#8211; [warning] Global configuration file \/etc\/masterha_default.cnf not found. Skipping.<br \/>\nSat Mar 24 02:40:55 2012 &#8211; [info] Reading application default configurations from \/etc\/conf\/masterha\/app1.cnf..<br \/>\nSat Mar 24 02:40:55 2012 &#8211; [info] Reading server configurations from \/etc\/conf\/masterha\/app1.cnf..<br \/>\nSat Mar 24 02:40:55 2012 &#8211; [info] MHA::MasterMonitor version 0.53.<br \/>\nSat Mar 24 02:40:55 2012 &#8211; [error][\/usr\/lib\/perl5\/vendor_perl\/MHA\/MasterMonitor.pm, ln298] Got MySQL error when connecting db01.yorozuyah.local(192.168.0.151:3306) :1045:Access denied for user &#8216;root&#8217;@&#8217;192.168.0.150&#8217; (using password: NO), but this is not mysql crash. Check MySQL server settings.<br \/>\nat \/usr\/lib\/perl5\/vendor_perl\/MHA\/ServerManager.pm line 251<br \/>\nSat Mar 24 02:40:55 2012 &#8211; [error][\/usr\/lib\/perl5\/vendor_perl\/MHA\/MasterMonitor.pm, ln298] Got MySQL error when connecting db02.yorozuyah.local(192.168.0.152:3306) :1130:Host &#8216;192.168.0.150&#8217; is not allowed to connect to this MySQL server, but this is not mysql crash. Check MySQL server settings.<br \/>\nat \/usr\/lib\/perl5\/vendor_perl\/MHA\/ServerManager.pm line 251<br \/>\nSat Mar 24 02:40:55 2012 &#8211; [error][\/usr\/lib\/perl5\/vendor_perl\/MHA\/MasterMonitor.pm, ln298] Got MySQL error when connecting db03.yorozuyah.local(192.168.0.153:3306) :1130:Host &#8216;192.168.0.150&#8217; is not allowed to connect to this MySQL server, but this is not mysql crash. Check MySQL server settings.<br \/>\nat \/usr\/lib\/perl5\/vendor_perl\/MHA\/ServerManager.pm line 251<br \/>\nSat Mar 24 02:40:55 2012 &#8211; [error][\/usr\/lib\/perl5\/vendor_perl\/MHA\/MasterMonitor.pm, ln298] Got fatal error, stopping operations<br \/>\nSat Mar 24 02:40:55 2012 &#8211; [error][\/usr\/lib\/perl5\/vendor_perl\/MHA\/MasterMonitor.pm, ln475] Error happend on checking configurations. at \/usr\/lib\/perl5\/vendor_perl\/MHA\/MasterMonitor.pm line 298<br \/>\nSat Mar 24 02:40:55 2012 &#8211; [error][\/usr\/lib\/perl5\/vendor_perl\/MHA\/MasterMonitor.pm, ln644] Error happened on monitoring servers.<br \/>\nSat Mar 24 02:40:55 2012 &#8211; [info] Got exit code 1 (Not master dead).<\/p>\n<p>MySQL Replication Health is NOT OK!<br \/>\n\u2191<br \/>\n\u3060\u3081\u307f\u305f\u3044<\/p>\n<\/div>\n<p>mysql\u306eroot\u30e6\u30fc\u30b6\u306e\u30ed\u30b0\u30a4\u30f3\u8a31\u53ef\u304c\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u7121\u304b\u3063\u305f\u30fb\u30fb\u30fb\u3002<\/p>\n<div class=\"command\">\u30de\u30b9\u30bf\u30fc\u304b\u3089\u30e6\u30fc\u30b6\u4f5c\u6210\u3057\u3066\u3082\u3046\u4e00\u5ea6mysql&gt; GRANT ALL ON *.* TO root@&#8217;192.168.0.%&#8217;;<\/p>\n<p># masterha_check_repl &#8211;conf=\/etc\/conf\/masterha\/app1.cnf<br \/>\nSat Mar 24 02:50:11 2012 &#8211; [warning] Global configuration file \/etc\/masterha_default.cnf not found. Skipping.<br \/>\nSat Mar 24 02:50:11 2012 &#8211; [info] Reading application default configurations from \/etc\/conf\/masterha\/app1.cnf..<br \/>\nSat Mar 24 02:50:11 2012 &#8211; [info] Reading server configurations from \/etc\/conf\/masterha\/app1.cnf..<br \/>\nSat Mar 24 02:50:11 2012 &#8211; [info] MHA::MasterMonitor version 0.53.<br \/>\nSat Mar 24 02:50:12 2012 &#8211; [info] Dead Servers:<br \/>\nSat Mar 24 02:50:12 2012 &#8211; [info] Alive Servers:<br \/>\nSat Mar 24 02:50:12 2012 &#8211; [info] db01.yorozuyah.local(192.168.0.151:3306)<br \/>\nSat Mar 24 02:50:12 2012 &#8211; [info] db02.yorozuyah.local(192.168.0.152:3306)<br \/>\nSat Mar 24 02:50:12 2012 &#8211; [info] db03.yorozuyah.local(192.168.0.153:3306)<br \/>\nSat Mar 24 02:50:12 2012 &#8211; [info] Alive Slaves:<br \/>\nSat Mar 24 02:50:12 2012 &#8211; [info] db02.yorozuyah.local(192.168.0.152:3306) Version=5.0.77-log (oldest major version between slaves) log-bin:enabled<br \/>\nSat Mar 24 02:50:12 2012 &#8211; [info] Replicating from db01.yorozuyah.local(192.168.0.151:3306)<br \/>\nSat Mar 24 02:50:12 2012 &#8211; [info] db03.yorozuyah.local(192.168.0.153:3306) Version=5.0.77-log (oldest major version between slaves) log-bin:enabled<br \/>\nSat Mar 24 02:50:12 2012 &#8211; [info] Replicating from db01.yorozuyah.local(192.168.0.151:3306)<br \/>\nSat Mar 24 02:50:12 2012 &#8211; [info] Current Alive Master: db01.yorozuyah.local(192.168.0.151:3306)<br \/>\nSat Mar 24 02:50:12 2012 &#8211; [info] Checking slave configurations..<br \/>\nSat Mar 24 02:50:12 2012 &#8211; [info] read_only=1 is not set on slave db02.yorozuyah.local(192.168.0.152:3306).<br \/>\nSat Mar 24 02:50:12 2012 &#8211; [warning] relay_log_purge=0 is not set on slave db02.yorozuyah.local(192.168.0.152:3306).<br \/>\nSat Mar 24 02:50:12 2012 &#8211; [info] read_only=1 is not set on slave db03.yorozuyah.local(192.168.0.153:3306).<br \/>\nSat Mar 24 02:50:12 2012 &#8211; [warning] relay_log_purge=0 is not set on slave db03.yorozuyah.local(192.168.0.153:3306).<br \/>\nSat Mar 24 02:50:12 2012 &#8211; [info] Checking replication filtering settings..<br \/>\nSat Mar 24 02:50:12 2012 &#8211; [info] binlog_do_db= , binlog_ignore_db=<br \/>\nSat Mar 24 02:50:12 2012 &#8211; [info] Replication filtering check ok.<br \/>\nSat Mar 24 02:50:12 2012 &#8211; [info] Starting SSH connection tests..<br \/>\nSat Mar 24 02:50:14 2012 &#8211; [info] All SSH connection tests passed successfully.<br \/>\nSat Mar 24 02:50:14 2012 &#8211; [info] Checking MHA Node version..<br \/>\nSat Mar 24 02:50:15 2012 &#8211; [info] Version check ok.<br \/>\nSat Mar 24 02:50:15 2012 &#8211; [info] Checking SSH publickey authentication settings on the current master..<br \/>\nSat Mar 24 02:50:15 2012 &#8211; [info] HealthCheck: SSH to db01.yorozuyah.local is reachable.<br \/>\nSat Mar 24 02:50:15 2012 &#8211; [info] Master MHA Node version is 0.53.<br \/>\nSat Mar 24 02:50:15 2012 &#8211; [info] Checking recovery script configurations on the current master..<br \/>\nSat Mar 24 02:50:15 2012 &#8211; [info] Executing command: save_binary_logs &#8211;command=test &#8211;start_pos=4 &#8211;binlog_dir=\/var\/lib\/mysql,\/var\/log\/mysql &#8211;output_file=\/var\/lib\/mysql\/log\/masterha\/app1\/save_binary_logs_test &#8211;manager_version=0.53 &#8211;start_file=mysql-bin.000002<br \/>\nSat Mar 24 02:50:15 2012 &#8211; [info] Connecting to root@db01.yorozuyah.local(db01.yorozuyah.local)..<br \/>\nCreating \/var\/lib\/mysql\/log\/masterha\/app1 if not exists.. ok.<br \/>\nChecking output directory is accessible or not..<br \/>\nok.<br \/>\nBinlog found at \/var\/lib\/mysql, up to mysql-bin.000002<br \/>\nSat Mar 24 02:50:15 2012 &#8211; [info] Master setting check done.<br \/>\nSat Mar 24 02:50:15 2012 &#8211; [info] Checking SSH publickey authentication and checking recovery script configurations on all alive slave servers..<br \/>\nSat Mar 24 02:50:15 2012 &#8211; [info] Executing command : apply_diff_relay_logs &#8211;command=test &#8211;slave_user=root &#8211;slave_host=db02.yorozuyah.local &#8211;slave_ip=192.168.0.152 &#8211;slave_port=3306 &#8211;workdir=\/var\/lib\/mysql\/log\/masterha\/app1 &#8211;target_version=5.0.77-log &#8211;manager_version=0.53 &#8211;relay_log_info=\/var\/lib\/mysql\/relay-log.info &#8211;relay_dir=\/var\/lib\/mysql\/ &#8211;slave_pass=xxx<br \/>\nSat Mar 24 02:50:15 2012 &#8211; [info] Connecting to root@192.168.0.152(db02.yorozuyah.local:22)..<br \/>\nmysqlbinlog version is 3.2 (included in MySQL Client 5.0 or lower). This is not recommended. Consider upgrading MySQL Client to 5.1 or higher.<br \/>\nChecking slave recovery environment settings..<br \/>\nOpening \/var\/lib\/mysql\/relay-log.info &#8230; ok.<br \/>\nRelay log found at \/var\/lib\/mysql, up to mysqld-relay-bin.000002<br \/>\nTemporary relay log file is \/var\/lib\/mysql\/mysqld-relay-bin.000002<br \/>\nTesting mysql connection and privileges.. done.<br \/>\nTesting mysqlbinlog output.. done.<br \/>\nCleaning up test file(s).. done.<br \/>\nSat Mar 24 02:50:15 2012 &#8211; [info] Executing command : apply_diff_relay_logs &#8211;command=test &#8211;slave_user=root &#8211;slave_host=db03.yorozuyah.local &#8211;slave_ip=192.168.0.153 &#8211;slave_port=3306 &#8211;workdir=\/var\/lib\/mysql\/log\/masterha\/app1 &#8211;target_version=5.0.77-log &#8211;manager_version=0.53 &#8211;relay_log_info=\/var\/lib\/mysql\/relay-log.info &#8211;relay_dir=\/var\/lib\/mysql\/ &#8211;slave_pass=xxx<br \/>\nSat Mar 24 02:50:15 2012 &#8211; [info] Connecting to root@192.168.0.153(db03.yorozuyah.local:22)..<br \/>\nmysqlbinlog version is 3.2 (included in MySQL Client 5.0 or lower). This is not recommended. Consider upgrading MySQL Client to 5.1 or higher.<br \/>\nChecking slave recovery environment settings..<br \/>\nOpening \/var\/lib\/mysql\/relay-log.info &#8230; ok.<br \/>\nRelay log found at \/var\/lib\/mysql, up to mysqld-relay-bin.000002<br \/>\nTemporary relay log file is \/var\/lib\/mysql\/mysqld-relay-bin.000002<br \/>\nTesting mysql connection and privileges.. done.<br \/>\nTesting mysqlbinlog output.. done.<br \/>\nCleaning up test file(s).. done.<br \/>\nSat Mar 24 02:50:15 2012 &#8211; [info] Slaves settings check done.<br \/>\nSat Mar 24 02:50:15 2012 &#8211; [info]<br \/>\ndb01.yorozuyah.local (current master)<br \/>\n+&#8211;db02.yorozuyah.local<br \/>\n+&#8211;db03.yorozuyah.local<\/p>\n<p>Sat Mar 24 02:50:15 2012 &#8211; [info] Checking replication health on db02.yorozuyah.local..<br \/>\nSat Mar 24 02:50:15 2012 &#8211; [info] ok.<br \/>\nSat Mar 24 02:50:15 2012 &#8211; [info] Checking replication health on db03.yorozuyah.local..<br \/>\nSat Mar 24 02:50:15 2012 &#8211; [info] ok.<br \/>\nSat Mar 24 02:50:15 2012 &#8211; [warning] master_ip_failover_script is not defined.<br \/>\nSat Mar 24 02:50:15 2012 &#8211; [warning] shutdown_script is not defined.<br \/>\nSat Mar 24 02:50:15 2012 &#8211; [info] Got exit code 0 (Not master dead).<\/p>\n<p>MySQL Replication Health is OK.<br \/>\n\u2193<br \/>\nOK\u3067\u3059<\/p>\n<\/div>\n<p>\u3042\u3068\u306f\u3001manager\u3092\u8d77\u52d5\u3057\u3066\u304b\u3089\u3001\u30de\u30b9\u30bf\u30fc\u306emysqld\u3068mysqld_safe\u3092kill\u3059\u308c\u3070\u81ea\u52d5\u7684\u306b\u65e7\u30b9\u30ec\u30fc\u30d6\u306e\u3069\u308c\u304b\u304c\u30de\u30b9\u30bf\u30fc\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3042\u308f\u305b\u3066\u3001\u305d\u306e\u6642\u306bDNS\u3092\u66f8\u304d\u63db\u3048\u3066\u30b5\u30fc\u30d3\u30b9\u7528\u306e\u30de\u30b9\u30bf\u30fcA\u30ec\u30b3\u30fc\u30c9\u3092\u65b0\u30de\u30b9\u30bf\u30fc\u306e\u30a2\u30c9\u30ec\u30b9\u306b\u3057\u3066\u3001\u30b9\u30ec\u30fc\u30d6\u306eA\u30ec\u30b3\u30fc\u30c9\u304b\u3089\u65b0\u30de\u30b9\u30bf\u30fc\u306e\u30a2\u30c9\u30ec\u30b9\u3092\u524a\u9664\u3059\u308b\u3002<\/p>\n<div class=\"command\">\n<p>\u3082\u3068\u3082\u3068\u306f\u3053\u3046\u306a\u3063\u3066\u3044\u305f\u306e\u3092<\/p>\n<p>db01 IN A 192.168.0.151<br \/>\ndb02 IN A 192.168.0.152<br \/>\ndb03 IN A 192.168.0.153<br \/>\n; master<br \/>\ndbm IN A 192.168.0.151<br \/>\n; slave<br \/>\ndbs IN A 192.168.0.152<br \/>\ndbs IN A 192.168.0.153<\/p>\n<p>\u2193\u3000db01\u304c\u843d\u3061\u305f\u6642\u306b\u3053\u3046\u3059\u308b<\/p>\n<p>db01 IN A 192.168.0.151<br \/>\ndb02 IN A 192.168.0.152<br \/>\ndb03 IN A 192.168.0.153<br \/>\n; master<br \/>\ndbm IN A 192.168.0.152\uff08db02\u304c\u30de\u30b9\u30bf\u30fc\u306b\u6607\u683c\u3057\u305f\u5834\u5408\uff09<br \/>\n; slave<br \/>\ndbs IN A 192.168.0.153\uff08\u751f\u304d\u3066\u3044\u308b\u30b9\u30ec\u30fc\u30d6\u3060\u3051\u3092\u6b8b\u3059\uff09<\/p>\n<\/div>\n<p>\u305d\u306e\u305f\u3081\u306b\u306f\u3001master_ip_failover\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f7f\u3046\u3089\u3057\u3044\u3002<br \/>\n\u30bd\u30fc\u30b9\u306b\u542b\u307e\u308c\u3066\u307e\u3059\u3002<\/p>\n<p><strong>\u30104:30\u3011<\/strong><\/p>\n<p>maste_ip_failover\u306e\u524d\u306b\u3001dynamicDNS\u3067\u30ec\u30b3\u30fc\u30c9\u304c\u66f8\u304d\u63db\u3048\u3089\u308c\u308b\u304b\u78ba\u8a8d\u30fb\u30fb\u30fb\u304c\u3067\u304d\u306a\u3044\u3002<\/p>\n<div class=\"command\"># nsupdate<br \/>\nserver dns01.yorozuyah.local<br \/>\nupdate delete dbm.yorozuyah.local A<br \/>\nupdate add dbm.yorozuyah.local 3600 IN A 192.168.0.152<br \/>\n&gt; send<br \/>\nupdate failed: SERVFAILpermission\u3092\u5909\u3048\u3068\u304b\u306a\u3044\u3068\u99c4\u76ee\u3067\u3057\u305f\u3002<\/p>\n<p># cd \/var\/<br \/>\n# chmod g+w named<\/p>\n<\/div>\n<p>\u3053\u3053\u3067\u3001\u52d5\u7684\u306bDNS\u30ec\u30b3\u30fc\u30c9\u3092\u66f8\u304d\u63db\u3048\u308b\u3088\u3046\u306b\u7c21\u6613\u30b9\u30af\u30ea\u30d7\u30c8\u4f5c\u6210\u3002<\/p>\n<div class=\"command\">\u5b89\u76f4\u306bddns\u3068\u3044\u3046\u540d\u524d\u3067\u3001\/usr\/local\/bin\u306b\u4f5c\u308a\u307e\u3057\u305f\u3002#vi \/usr\/local\/bin\/ddns<br \/>\n\u2192<a href=\"https:\/\/a23187.yorozuyah.com\/blog\/wp-content\/uploads\/2012\/03\/ddns1.zip\">ddns<\/a>\n<\/div>\n<p>master_ip_failover\u3092\/scripts\/masterha\/\u306b\u7f6e\u3044\u3066\u3001\u4e0a\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u6307\u5b9a\u3002<\/p>\n<div class=\"command\">\n<p>\u629c\u7c8b<\/p>\n<p>88 ## Update master ip on the catalog database, etc<br \/>\n89 #FIXME_xxx;<br \/>\n90<br \/>\n91 system(&#8220;ddns delete dbm.yorozuyah.local $orig_master_ip&#8221;);<br \/>\n\u2191\u65e7\u30de\u30b9\u30bf\u30fc\u3092\u30b5\u30fc\u30d3\u30b9\u7528\u306e\u30de\u30b9\u30bf\u30fc\u30db\u30b9\u30c8\u540d\u304b\u3089\u5916\u3057\u3066<br \/>\n92 system(&#8220;ddns add dbm.yorozuyah.local $new_master_ip&#8221;);<br \/>\n\u2191\u65b0\u30de\u30b9\u30bf\u30fc\u3092\u30b5\u30fc\u30d3\u30b9\u7528\u306e\u30de\u30b9\u30bf\u30fc\u30db\u30b9\u30c8\u540d\u306b\u52a0\u3048\u3066<br \/>\n93 system(&#8220;ddns delete dbs.yorozuyah.local $new_master_ip&#8221;);<br \/>\n\u2191\u65b0\u30de\u30b9\u30bf\u30fc\u3092\u30b5\u30fc\u30d3\u30b9\u7528\u306e\u30b9\u30ec\u30fc\u30d6\u30db\u30b9\u30c8\u540d\u304b\u3089\u5916\u3059<\/p>\n<\/div>\n<p>\u305d\u3057\u3066\u305f\u3081\u3057\u306b\u30d5\u30a7\u30fc\u30eb\u30aa\u30fc\u30d0\u3055\u305b\u308b\u3068\u3002<\/p>\n<div class=\"command\">Sat Mar 24 05:19:57 2012 &#8211; [info] Executing master IP activate script:<br \/>\nSat Mar 24 05:19:57 2012 &#8211; [info] \/scripts\/masterha\/master_ip_failover &#8211;command=start &#8211;ssh_user=root &#8211;orig_master_host=db02.yorozuyah.local &#8211;orig_master_ip=192.168.0.152 &#8211;orig_master_port=3306 &#8211;new_master_host=db01.yorozuyah.local &#8211;new_master_ip=192.168.0.151 &#8211;new_master_port=3306<br \/>\nCan&#8217;t locate object method &#8220;new&#8221; via package &#8220;MHA::DBHelper&#8221; (perhaps you forgot to load &#8220;MHA::DBHelper&#8221;?) at \/scripts\/masterha\/master_ip_failover line 70.<br \/>\nSat Mar 24 05:19:57 2012 &#8211; [error][\/usr\/lib\/perl5\/vendor_perl\/MH<br \/>\nMHA::DBHelper\u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u7121\u3044\uff1f\uff1f<\/div>\n<p>\u8ffd\u8a18\uff01<\/p>\n<div class=\"command\">\n<p>\u629c\u7c8b<\/p>\n<p>25 use Getopt::Long;<br \/>\n26 use MHA::DBHelper;<\/p>\n<\/div>\n<p><strong>\u30105:30\u3011<\/strong><\/p>\n<p>\u3084\u3063\u3068\u6700\u7d42\u78ba\u8a8d\uff01<\/p>\n<div class=\"command\">\n<p>\u307e\u305a\u3001MHA\u306e\u30de\u30cd\u30fc\u30b8\u30e3\u8d77\u52d5<br \/>\n[root@dns01 var]# masterha_manager &#8211;conf=\/etc\/conf\/masterha\/app1.cnf<br \/>\nSat Mar 24 05:41:20 2012 &#8211; [warning] Global configuration file \/etc\/masterha_default.cnf not found. Skipping.<br \/>\nSat Mar 24 05:41:20 2012 &#8211; [info] Reading application default configurations from \/etc\/conf\/masterha\/app1.cnf..<br \/>\nSat Mar 24 05:41:20 2012 &#8211; [info] Reading server configurations from \/etc\/conf\/masterha\/app1.cnf..<br \/>\nSat Mar 24 05:41:20 2012 &#8211; [info] MHA::MasterMonitor version 0.53.<br \/>\nSat Mar 24 05:41:20 2012 &#8211; [info] Dead Servers:<br \/>\nSat Mar 24 05:41:20 2012 &#8211; [info] Alive Servers:<br \/>\nSat Mar 24 05:41:20 2012 &#8211; [info] db01.yorozuyah.local(192.168.0.151:3306)<br \/>\nSat Mar 24 05:41:20 2012 &#8211; [info] db02.yorozuyah.local(192.168.0.152:3306)<br \/>\nSat Mar 24 05:41:20 2012 &#8211; [info] db03.yorozuyah.local(192.168.0.153:3306)<br \/>\nSat Mar 24 05:41:20 2012 &#8211; [info] Alive Slaves:<br \/>\nSat Mar 24 05:41:20 2012 &#8211; [info] db02.yorozuyah.local(192.168.0.152:3306) Version=5.0.77-log (oldest major version between slaves) log-bin:enabled<br \/>\nSat Mar 24 05:41:20 2012 &#8211; [info] Replicating from db01.yorozuyah.local(192.168.0.151:3306)<br \/>\nSat Mar 24 05:41:20 2012 &#8211; [info] db03.yorozuyah.local(192.168.0.153:3306) Version=5.0.77-log (oldest major version between slaves) log-bin:enabled<br \/>\nSat Mar 24 05:41:20 2012 &#8211; [info] Replicating from db01.yorozuyah.local(192.168.0.151:3306)<br \/>\nSat Mar 24 05:41:20 2012 &#8211; [info] Current Alive Master: db01.yorozuyah.local(192.168.0.151:3306)<br \/>\nSat Mar 24 05:41:20 2012 &#8211; [info] Checking slave configurations..<br \/>\nSat Mar 24 05:41:20 2012 &#8211; [warning] relay_log_purge=0 is not set on slave db02.yorozuyah.local(192.168.0.152:3306).<br \/>\nSat Mar 24 05:41:20 2012 &#8211; [warning] relay_log_purge=0 is not set on slave db03.yorozuyah.local(192.168.0.153:3306).<br \/>\nSat Mar 24 05:41:20 2012 &#8211; [info] Checking replication filtering settings..<br \/>\nSat Mar 24 05:41:20 2012 &#8211; [info] binlog_do_db= , binlog_ignore_db=<br \/>\nSat Mar 24 05:41:20 2012 &#8211; [info] Replication filtering check ok.<br \/>\nSat Mar 24 05:41:20 2012 &#8211; [info] Starting SSH connection tests..<br \/>\nSat Mar 24 05:41:22 2012 &#8211; [info] All SSH connection tests passed successfully.<br \/>\nSat Mar 24 05:41:22 2012 &#8211; [info] Checking MHA Node version..<br \/>\nSat Mar 24 05:41:22 2012 &#8211; [info] Version check ok.<br \/>\nSat Mar 24 05:41:22 2012 &#8211; [info] Checking SSH publickey authentication settings on the current master..<br \/>\nSat Mar 24 05:41:22 2012 &#8211; [info] HealthCheck: SSH to db01.yorozuyah.local is reachable.<br \/>\nSat Mar 24 05:41:23 2012 &#8211; [info] Master MHA Node version is 0.53.<br \/>\nSat Mar 24 05:41:23 2012 &#8211; [info] Checking recovery script configurations on the current master..<br \/>\nSat Mar 24 05:41:23 2012 &#8211; [info] Executing command: save_binary_logs &#8211;command=test &#8211;start_pos=4 &#8211;binlog_dir=\/var\/lib\/mysql,\/var\/log\/mysql &#8211;output_file=\/var\/lib\/mysql\/log\/masterha\/app1\/save_binary_logs_test &#8211;manager_version=0.53 &#8211;start_file=mysql-bin.000008<br \/>\nSat Mar 24 05:41:23 2012 &#8211; [info] Connecting to root@db01.yorozuyah.local(db01.yorozuyah.local)..<br \/>\nCreating \/var\/lib\/mysql\/log\/masterha\/app1 if not exists.. ok.<br \/>\nChecking output directory is accessible or not..<br \/>\nok.<br \/>\nBinlog found at \/var\/lib\/mysql, up to mysql-bin.000008<br \/>\nSat Mar 24 05:41:23 2012 &#8211; [info] Master setting check done.<br \/>\nSat Mar 24 05:41:23 2012 &#8211; [info] Checking SSH publickey authentication and checking recovery script configurations on all alive slave servers..<br \/>\nSat Mar 24 05:41:23 2012 &#8211; [info] Executing command : apply_diff_relay_logs &#8211;command=test &#8211;slave_user=root &#8211;slave_host=db02.yorozuyah.local &#8211;slave_ip=192.168.0.152 &#8211;slave_port=3306 &#8211;workdir=\/var\/lib\/mysql\/log\/masterha\/app1 &#8211;target_version=5.0.77-log &#8211;manager_version=0.53 &#8211;relay_log_info=\/var\/lib\/mysql\/relay-log.info &#8211;relay_dir=\/var\/lib\/mysql\/ &#8211;slave_pass=xxx<br \/>\nSat Mar 24 05:41:23 2012 &#8211; [info] Connecting to root@192.168.0.152(db02.yorozuyah.local:22)..<br \/>\nmysqlbinlog version is 3.2 (included in MySQL Client 5.0 or lower). This is not recommended. Consider upgrading MySQL Client to 5.1 or higher.<br \/>\nChecking slave recovery environment settings..<br \/>\nOpening \/var\/lib\/mysql\/relay-log.info &#8230; ok.<br \/>\nRelay log found at \/var\/lib\/mysql, up to db02-relay-bin.000002<br \/>\nTemporary relay log file is \/var\/lib\/mysql\/db02-relay-bin.000002<br \/>\nTesting mysql connection and privileges.. done.<br \/>\nTesting mysqlbinlog output.. done.<br \/>\nCleaning up test file(s).. done.<br \/>\nSat Mar 24 05:41:23 2012 &#8211; [info] Executing command : apply_diff_relay_logs &#8211;command=test &#8211;slave_user=root &#8211;slave_host=db03.yorozuyah.local &#8211;slave_ip=192.168.0.153 &#8211;slave_port=3306 &#8211;workdir=\/var\/lib\/mysql\/log\/masterha\/app1 &#8211;target_version=5.0.77-log &#8211;manager_version=0.53 &#8211;relay_log_info=\/var\/lib\/mysql\/relay-log.info &#8211;relay_dir=\/var\/lib\/mysql\/ &#8211;slave_pass=xxx<br \/>\nSat Mar 24 05:41:23 2012 &#8211; [info] Connecting to root@192.168.0.153(db03.yorozuyah.local:22)..<br \/>\nmysqlbinlog version is 3.2 (included in MySQL Client 5.0 or lower). This is not recommended. Consider upgrading MySQL Client to 5.1 or higher.<br \/>\nChecking slave recovery environment settings..<br \/>\nOpening \/var\/lib\/mysql\/relay-log.info &#8230; ok.<br \/>\nRelay log found at \/var\/lib\/mysql, up to db03-relay-bin.000002<br \/>\nTemporary relay log file is \/var\/lib\/mysql\/db03-relay-bin.000002<br \/>\nTesting mysql connection and privileges.. done.<br \/>\nTesting mysqlbinlog output.. done.<br \/>\nCleaning up test file(s).. done.<br \/>\nSat Mar 24 05:41:23 2012 &#8211; [info] Slaves settings check done.<br \/>\nSat Mar 24 05:41:23 2012 &#8211; [info]<br \/>\ndb01.yorozuyah.local (current master)<br \/>\n+&#8211;db02.yorozuyah.local<br \/>\n+&#8211;db03.yorozuyah.local<\/p>\n<p>Sat Mar 24 05:41:23 2012 &#8211; [info] Checking master_ip_failover_script status:<br \/>\nSat Mar 24 05:41:23 2012 &#8211; [info] \/scripts\/masterha\/master_ip_failover &#8211;command=status &#8211;ssh_user=root &#8211;orig_master_host=db01.yorozuyah.local &#8211;orig_master_ip=192.168.0.151 &#8211;orig_master_port=3306<br \/>\nSat Mar 24 05:41:23 2012 &#8211; [info] OK.<br \/>\nSat Mar 24 05:41:23 2012 &#8211; [warning] shutdown_script is not defined.<br \/>\nSat Mar 24 05:41:23 2012 &#8211; [info] Set master ping interval 3 seconds.<br \/>\nSat Mar 24 05:41:23 2012 &#8211; [warning] secondary_check_script is not defined. It is highly recommended setting it to check master reachability from two or more routes.<br \/>\nSat Mar 24 05:41:23 2012 &#8211; [info] Starting ping health check on db01.yorozuyah.local(192.168.0.151:3306)..<br \/>\nSat Mar 24 05:41:23 2012 &#8211; [info] Ping(SELECT) succeeded, waiting until MySQL doesn&#8217;t respond..<\/p>\n<\/div>\n<p>DNS\u3092\u78ba\u8a8d<\/p>\n<div class=\"command\">\n<p>[root@db02 ~]# nslookup<br \/>\n&gt; dbs\u3000\u3000\u3000\u3000\u3000\u2190\u30b5\u30fc\u30d3\u30b9\u7528\u306e\u30b9\u30ec\u30fc\u30d6\u30db\u30b9\u30c8\u540d<br \/>\nServer: 192.168.0.150<br \/>\nAddress: 192.168.0.150#53<br \/>\nName: dbs.yorozuyah.local<br \/>\nAddress: 192.168.0.152\u3000\u3000\u3000\u3000\u3000\u2190db02<br \/>\nName: dbs.yorozuyah.local<br \/>\nAddress: 192.168.0.153\u3000\u3000\u3000\u3000\u3000\u2190db03<\/p>\n<p>&gt; dbm\u3000\u3000\u3000\u3000\u3000\u2190\u30b5\u30fc\u30d3\u30b9\u7528\u306e\u30de\u30b9\u30bf\u30fc\u30db\u30b9\u30c8\u540d<br \/>\nServer: 192.168.0.150<br \/>\nAddress: 192.168.0.150#53<br \/>\nName: dbm.yorozuyah.local<br \/>\nAddress: 192.168.0.151\u3000\u3000\u3000\u3000\u3000\u2190db01<\/p>\n<\/div>\n<p>db01\u306e\u30de\u30b9\u30bf\u30fcmysql\u3092\u505c\u6b62<\/p>\n<div class=\"command\">\n<p>[root@db01 ~]# ps -ef |grep mysqld<br \/>\nroot 16761 2641 0 05:33 pts\/0 00:00:00 \/bin\/sh \/usr\/bin\/mysqld_safe<br \/>\nmysql 16787 16761 0 05:33 pts\/0 00:00:00 \/usr\/libexec\/mysqld &#8211;basedir=\/usr &#8211;datadir=\/var\/lib\/mysql &#8211;user=mysql &#8211;pid-file=\/var\/lib\/mysql\/db01.pid &#8211;skip-external-locking &#8211;port=3306 &#8211;socket=\/var\/lib\/mysql\/mysql.sock<br \/>\nroot 17039 2641 0 05:43 pts\/0 00:00:00 grep mysqld<br \/>\n[root@db01 ~]# kill -9 16761 16787<\/p>\n<\/div>\n<p>\u3057\u3070\u3089\u304f\u3059\u308b\u3068\u30de\u30cd\u30fc\u30b8\u30e3\u30ed\u30b0\u304c\u52d5\u304d\u59cb\u3081\u308b\u3002<\/p>\n<div class=\"command\">\n<p>\u7701\u7565<br \/>\n\uff1a<br \/>\n\uff1a<br \/>\n&#8212;&#8211; Failover Report &#8212;&#8211;<\/p>\n<p>app1: MySQL Master failover db01.yorozuyah.local to db02.yorozuyah.local succeeded<\/p>\n<p>Master db01.yorozuyah.local is down!<\/p>\n<p>Check MHA Manager logs at dns01 for details.<\/p>\n<p>Started automated(non-interactive) failover.<br \/>\nInvalidated master IP address on db01.yorozuyah.local.<br \/>\nThe latest slave db02.yorozuyah.local(192.168.0.152:3306) has all relay logs for recovery.<br \/>\nSelected db02.yorozuyah.local as a new master.<br \/>\ndb02.yorozuyah.local: OK: Applying all logs succeeded.<br \/>\ndb02.yorozuyah.local: OK: Activated master IP address.<br \/>\ndb03.yorozuyah.local: This host has the latest relay log events.<br \/>\nGenerating relay diff files from the latest slave succeeded.<br \/>\ndb03.yorozuyah.local: OK: Applying all logs succeeded. Slave started, replicating from db02.yorozuyah.local.<br \/>\ndb02.yorozuyah.local: Resetting slave info succeeded.<br \/>\nMaster failover to db02.yorozuyah.local(192.168.0.152:3306) completed successfully.<\/p>\n<\/div>\n<p>\u6b63\u5e38\u306b\u30d5\u30a7\u30fc\u30eb\u30aa\u30fc\u30d0\u304c\u7d42\u308f\u3063\u305f\u307f\u305f\u3044\u3002<\/p>\n<p>\u6b8b\u3063\u305f\u30b9\u30ec\u30fc\u30d6\u306e\u30ec\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u72b6\u6cc1\u306f\uff1f<\/p>\n<div class=\"command\">\n<p>mysql&gt; show slave status\\G<br \/>\n*************************** 1. row ***************************<br \/>\nSlave_IO_State: Waiting for master to send event<br \/>\nMaster_Host: db02.yorozuyah.local<br \/>\nMaster_User: repl<br \/>\nMaster_Port: 3306<br \/>\nConnect_Retry: 60<br \/>\nMaster_Log_File: mysql-bin.000005<br \/>\nRead_Master_Log_Pos: 98<br \/>\nRelay_Log_File: db03-relay-bin.000002<br \/>\nRelay_Log_Pos: 235<br \/>\nRelay_Master_Log_File: mysql-bin.000005<br \/>\nSlave_IO_Running: Yes<br \/>\nSlave_SQL_Running: Yes<br \/>\nReplicate_Do_DB:<br \/>\nReplicate_Ignore_DB:<br \/>\nReplicate_Do_Table:<br \/>\nReplicate_Ignore_Table:<br \/>\nReplicate_Wild_Do_Table:<br \/>\nReplicate_Wild_Ignore_Table:<br \/>\nLast_Errno: 0<br \/>\nLast_Error:<br \/>\nSkip_Counter: 0<br \/>\nExec_Master_Log_Pos: 98<br \/>\nRelay_Log_Space: 235<br \/>\nUntil_Condition: None<br \/>\nUntil_Log_File:<br \/>\nUntil_Log_Pos: 0<br \/>\nMaster_SSL_Allowed: No<br \/>\nMaster_SSL_CA_File:<br \/>\nMaster_SSL_CA_Path:<br \/>\nMaster_SSL_Cert:<br \/>\nMaster_SSL_Cipher:<br \/>\nMaster_SSL_Key:<br \/>\nSeconds_Behind_Master: 0<br \/>\n1 row in set (0.00 sec)<\/p>\n<\/div>\n<p>\u30de\u30b9\u30bf\u30fc\u304cdb02\u306b\u306a\u3063\u3066\u307e\u3059\uff01<\/p>\n<p>db02\u306f\uff1f<\/p>\n<div class=\"command\">\n<p>mysql&gt; show master status;<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br \/>\n| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br \/>\n| mysql-bin.000005 | 98 | | |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br \/>\n1 row in set (0.00 sec)<\/p>\n<p>mysql&gt; show slave status;<br \/>\nEmpty set (0.00 sec)<\/p>\n<\/div>\n<p>\u30de\u30b9\u30bf\u30fc\u306b\u306a\u3063\u3066\u307e\u3059\u3002<\/p>\n<p>\u3061\u3083\u3093\u3068read_only\u304cOFF\u306b\u306a\u3063\u3066\u308b\u306e\u3082\u3042\u308a\u304c\u305f\u3044\u3002<\/p>\n<div class=\"command\">\n<p>mysql&gt; show global variables like &#8216;read_only&#8217;;<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;-+<br \/>\n| Variable_name | Value |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;-+<br \/>\n| read_only | OFF |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;-+<br \/>\n1 row in set (0.00 sec)<\/p>\n<\/div>\n<p>DNS\u306f\uff1f<\/p>\n<div class=\"command\">\n<p>&gt; dbs<br \/>\nServer: 192.168.0.150<br \/>\nAddress: 192.168.0.150#53<\/p>\n<p>Name: dbs.yorozuyah.local<br \/>\nAddress: 192.168.0.153\u3000\u3000\u3000\u3000\u3000\u2190\u751f\u304d\u3066\u3044\u308b\u30b9\u30ec\u30fc\u30d6db03<br \/>\n&gt;<br \/>\n&gt;<br \/>\n&gt; dbm<br \/>\nServer: 192.168.0.150<br \/>\nAddress: 192.168.0.150#53<\/p>\n<p>Name: dbm.yorozuyah.local<br \/>\nAddress: 192.168.0.152\u3000\u3000\u3000\u3000\u3000\u2190\u65b0\u30de\u30b9\u30bf\u30fcdb02<\/p>\n<\/div>\n<p><strong>\u30105:50\u3011<\/strong><br \/>\n\u78ba\u8a8d\u304a\u308f\u308a<\/p>\n<p>\u30b9\u30af\u30ea\u30d7\u30c8\u306f\u3082\u3046\u5c11\u3057\u3061\u3083\u3093\u3068\u66f8\u304f\u306e\u3068\u3001\u4f55\u3089\u304b\u306eDB\u51e6\u7406\u3092\u3057\u306a\u304c\u3089\u30d5\u30a7\u30fc\u30eb\u30aa\u30fc\u30d0\u3057\u305f\u6642\u306b\u30c7\u30fc\u30bf\u304c\u30ed\u30b9\u30c8\u3057\u306a\u3044\u304b\u306f\u5225\u9014\u78ba\u8a8d\u3067\u3059\u3002<br \/>\n\u3042\u3068\u3001\u4ed6\u306b\u3082\u30ec\u30dd\u30fc\u30c8\u30b9\u30af\u30ea\u30d7\u30c8\u306a\u3069\u30b5\u30f3\u30d7\u30eb\u304c\u30bd\u30fc\u30b9\u306b\u542b\u307e\u308c\u3066\u308b\u306e\u3067\u305d\u3061\u3089\u3082\u3002<\/p>\n<p>\u306f\u3042\u30016\u6642\u9593\u5f31\u3067\u69cb\u7bc9\u304b\u3089\u78ba\u8a8d\u307e\u3067\u306a\u3093\u3068\u304b\u51fa\u6765\u307e\u3057\u305f\u304c\u601d\u3063\u305f\u3088\u308a\u6642\u9593\u304c\u304b\u304b\u3063\u305f\u3002\u3002<br \/>\nVirtualBox\u306b4\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u4f5c\u6210\u3059\u308b\u3068\u3055\u3059\u304c\u306b\u91cd\u304f\u3066\u3001\u3068\u3044\u3046\u8a00\u3044\u8a33\u3002<\/p>\n<p>\u9593\u9055\u3063\u3066\u308b\u7b87\u6240\u304c\u3042\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u306e\u3067\u3001\u5f8c\u307b\u3069\u898b\u76f4\u3057\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u30b5\u30a4\u30c8\u3092\u53c2\u8003\u306b\u3055\u305b\u3066\u3044\u305f\u3060\u304d\u307e\u3057\u305f\u3002<\/p>\n<p><a title=\"http:\/\/d.hatena.ne.jp\/ke-16\/20110912\/1315824419\" href=\"http:\/\/d.hatena.ne.jp\/ke-16\/20110912\/1315824419\">http:\/\/d.hatena.ne.jp\/ke-16\/20110912\/1315824419<\/a><br \/>\n<a href=\"http:\/\/myhome.munetika.mydns.jp\/ossdbwiki\/index.php\/MySQL-MHA%E4%B8%8A%E3%81%A7%E3%81%AE%E3%83%95%E3%82%A7%E3%83%BC%E3%83%AB%E3%82%AA%E3%83%BC%E3%83%90%E3%83%BC%E5%87%A6%E7%90%86\">MySQL-MHA\u4e0a\u3067\u306e\u30d5\u30a7\u30fc\u30eb\u30aa\u30fc\u30d0\u30fc\u51e6\u7406<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>DeNA\u3067\u958b\u767a\u3055\u308c\u305f\u3042\u308a\u304c\u305f\u3044\u30c4\u30fc\u30ebMHA\u3092\u62dd\u501f\u3057\u3066\u3001HA\u69cb\u6210\u3092\u4f5c\u3063\u3066\u307f\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002 \u69cb\u6210\u306f dns01.yorozuyah.local\u3000\u3000DNS\u30b5\u30fc\u30d0\u517cMHA\u30de\u30cd\u30fc\u30b8\u30e3 db01.yorozuyah.local\u3000&hellip;&nbsp;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","footnotes":""},"categories":[24,22],"tags":[32],"_links":{"self":[{"href":"https:\/\/a23187.yorozuyah.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/747"}],"collection":[{"href":"https:\/\/a23187.yorozuyah.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/a23187.yorozuyah.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/a23187.yorozuyah.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/a23187.yorozuyah.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=747"}],"version-history":[{"count":38,"href":"https:\/\/a23187.yorozuyah.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/747\/revisions"}],"predecessor-version":[{"id":767,"href":"https:\/\/a23187.yorozuyah.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/747\/revisions\/767"}],"wp:attachment":[{"href":"https:\/\/a23187.yorozuyah.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=747"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/a23187.yorozuyah.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=747"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/a23187.yorozuyah.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=747"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}