{"id":1524,"date":"2009-01-22T10:55:53","date_gmt":"2009-01-22T14:55:53","guid":{"rendered":"http:\/\/blogs.n1zyy.com\/n1zyy\/?p=1524"},"modified":"2009-01-22T10:55:53","modified_gmt":"2009-01-22T14:55:53","slug":"mysql-replication","status":"publish","type":"post","link":"https:\/\/blogs.n1zyy.com\/n1zyy\/2009\/01\/22\/mysql-replication\/","title":{"rendered":"MySQL Replication"},"content":{"rendered":"<p>A few thoughts on MySQL replication:<\/p>\n<ul>\n<li>Since a &#8220;READ DATA FROM MASTER&#8221; will issue locks until the slave is up to sync, it&#8217;s a horrible way to bring up a new slave to an existing setup. What&#8217;s not written about a lot, but isn&#8217;t really a big secret, is that you should use the latest backup\/dump of the database to get the slave almost up to speed, and make sure you log its log position (from a SHOW SLAVE STATUS and SHOW MASTER STATUS). From there, you can just tell MySQL the binary log and the log position to resume at. In my case this means catching up on about 45,000 seconds, but it&#8217;s better than locking the database until it&#8217;s done.<\/li>\n<li>MySQL replicates temporary tables. I didn&#8217;t believe this at first, <a href=\"http:\/\/dev.mysql.com\/doc\/refman\/5.1\/en\/replication-features-temptables.html\">but it&#8217;s true<\/a>. This means that replicating to a machine used for lots of data mining that creates temporary tables from SELECTs that take 30 minutes to complete is a bad idea. As best as I can see, there&#8217;s no, &#8220;Don&#8217;t copy over temporary tables, silly&#8221; option, either.<\/li>\n<li>Running STOP SLAVE will seemingly wait for the current query to finish. (You could kill it, but that&#8217;d be bad&#8230;)<\/li>\n<li>If, in the process of bringing up a replicant for the first time, it&#8217;s trying to create temporary tables based on temporary tables&#8230;. You can tell it to ignore &#8220;table not found&#8221; errors by putting <tt>slave-skip-errors = 1146<\/tt> in your <tt>my.cnf<\/tt>: 1146 is the error for missing tables. This will keep replication going. Risky, but if you restored from a recent, complete backup, you&#8217;ll just skip creating temporary tables&#8230;<\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>A few thoughts on MySQL replication: Since a &#8220;READ DATA FROM MASTER&#8221; will issue locks until the slave is up to sync, it&#8217;s a horrible way to bring up a new slave to an existing setup. What&#8217;s not written about &hellip; <a href=\"https:\/\/blogs.n1zyy.com\/n1zyy\/2009\/01\/22\/mysql-replication\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1524","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.n1zyy.com\/n1zyy\/wp-json\/wp\/v2\/posts\/1524","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.n1zyy.com\/n1zyy\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.n1zyy.com\/n1zyy\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.n1zyy.com\/n1zyy\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.n1zyy.com\/n1zyy\/wp-json\/wp\/v2\/comments?post=1524"}],"version-history":[{"count":0,"href":"https:\/\/blogs.n1zyy.com\/n1zyy\/wp-json\/wp\/v2\/posts\/1524\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogs.n1zyy.com\/n1zyy\/wp-json\/wp\/v2\/media?parent=1524"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.n1zyy.com\/n1zyy\/wp-json\/wp\/v2\/categories?post=1524"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.n1zyy.com\/n1zyy\/wp-json\/wp\/v2\/tags?post=1524"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}