{"id":400,"date":"2012-01-22T00:28:05","date_gmt":"2012-01-22T00:28:05","guid":{"rendered":"http:\/\/www.omniweb.com\/wordpress\/?p=400"},"modified":"2013-01-11T23:19:17","modified_gmt":"2013-01-11T23:19:17","slug":"start-mysql-replication-on-a-slave","status":"publish","type":"post","link":"https:\/\/www.omniweb.com\/wordpress\/?p=400","title":{"rendered":"Start MySQL Replication on a slave"},"content":{"rendered":"<p>Had a problem with a slave database being a different (newer) version of MySQL than the master.  After downgrading to the correct version of MySQL, the replicated data was no longer consistent with the master.   ( For a good tool that can check the slave data&#8217;s consistency table by table, see here <a href=\"http:\/\/www.maatkit.org\/doc\/mk-table-checksum.html\" title=\"maatkit.org checksum tool\">http:\/\/www.maatkit.org\/doc\/mk-table-checksum.html<\/a> )<\/p>\n<p>To fix this, the following steps were taken:<br \/>\n1) stop mysql on the broken slave.<br \/>\n2) on another good slave, in mysql prompt type &#8216;stop slave&#8217;, then (may want to remove some updatelogs first) tar up the \/var\/lib\/mysql directory like so: &#8216;tar -cvpf good_slave.tar \/var\/lib\/mysql&#8217;, then type &#8216;start slave&#8217;<br \/>\n3) Copy the tar to the broken slave with sftp or what have you<br \/>\n4) on the broken slave, move the \/var\/lib\/mysql folder somewhere else for safekeeping such as &#8216;mv \/var\/lib\/mysql \/var\/lib\/broken_mysql&#8217;<br \/>\n5) untar the good_slave.tar file and make sure it goes in \/var\/lib\/mysql<br \/>\n6) Edit relay-log.info file, change the hostname, see step 6 here: <a href=\"http:\/\/www.redips.net\/mysql\/add-new-slave\/\">http:\/\/www.redips.net\/mysql\/add-new-slave\/<\/a><br \/>\n<code># first line before change<br \/>\n.\/existing_slave_name-relay-bin.000076<br \/>\n# first line after change<br \/>\n.\/new_slave_name-relay-bin.000001<\/code><\/p>\n<p>7) (not needed in this case since broken slave has it already, but for a new slave) Copy my.cnf and increment server-id &#8211; NOTE: edit the &#8220;relay-log&#8221; line with the new hostname!<br \/>\n&#8216;8) start mysql on the broken slave.  check &#8216;show slave status&#8217; and hopefully seconds behind decreases to zero quickly!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Had a problem with a slave database being a different (newer) version of MySQL than the master. After downgrading to the correct version of MySQL, the replicated data was no longer consistent with the master. ( For a good tool &hellip; <a href=\"https:\/\/www.omniweb.com\/wordpress\/?p=400\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.omniweb.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/400"}],"collection":[{"href":"https:\/\/www.omniweb.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.omniweb.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.omniweb.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.omniweb.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=400"}],"version-history":[{"count":9,"href":"https:\/\/www.omniweb.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/400\/revisions"}],"predecessor-version":[{"id":818,"href":"https:\/\/www.omniweb.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/400\/revisions\/818"}],"wp:attachment":[{"href":"https:\/\/www.omniweb.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=400"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.omniweb.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=400"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.omniweb.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=400"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}