{"id":5192,"date":"2017-03-29T14:41:36","date_gmt":"2017-03-29T11:41:36","guid":{"rendered":"http:\/\/skeletor.org.ua\/?p=5192"},"modified":"2017-03-29T14:46:56","modified_gmt":"2017-03-29T11:46:56","slug":"mysql-multi-source-replication","status":"publish","type":"post","link":"https:\/\/skeletor.org.ua\/?p=5192","title":{"rendered":"[mysql] Multi source replication"},"content":{"rendered":"<p>\u0418 \u0442\u0430\u043a, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c \u0441\u0435\u0431\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e: \u0435\u0441\u0442\u044c <strong>GTID<\/strong> \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u0438 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u043a\u0430\u043d\u0430\u043b \u0441 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043c\u0430\u0441\u0442\u0435\u0440\u0430. \u0412\u0440\u043e\u0434\u0435 \u0431\u044b \u0438 \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430: <strong>change master to &#8230; channel master2<\/strong>, \u043d\u043e \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0430 \u043d\u043e\u0432\u043e\u043c \u043a\u0430\u043d\u0430\u043b\u0435 <strong>master2<\/strong> \u043e\u043d\u0430 \u0441\u0432\u0430\u043b\u0438\u0442\u0441\u044f \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439:<\/p>\n<p><code>The slave is connecting using CHANGE MASTER TO MASTER_AUTO_POSITION = 1, but the master has purged binary logs containing GTIDs that the slave requires.', Error_code: 1236<\/code><\/p>\n<p>\u041a\u0430\u043a \u0436\u0435 \u0431\u044b\u0442\u044c? \u041e\u043f\u0438\u0448\u0443 \u043f\u043e \u0448\u0430\u0433\u0430\u043c, \u043a\u0430\u043a \u044d\u0442\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c.<\/p>\n<p><!--more--><\/p>\n<p>\u041e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0432\u0441\u0435 \u043a\u0430\u043d\u0430\u043b\u044b \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438:<\/p>\n<p><code>mysql&gt;stop slave;<\/code><\/p>\n<p>\u0417\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u043f\u043e\u0437\u0438\u0446\u0438\u044e\u00a0<strong>Executed_Gtid_Set<\/strong> \u0438\u0437 \u0432\u044b\u0432\u043e\u0434\u0430 <strong>show slave status<\/strong>. \u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p><code>Executed_Gtid_Set: 1136d9c4-0ecf-11e5-be7e-28d2445d8ed0:1-383562252,<br \/>\n53d58b0f-eb6f-11e6-9215-392e3ca483a1:1-1095535,<br \/>\n82ad4575-4739-11e6-a34c-8a4ad13bb2ca:1-57542,<br \/>\nbcdd5c11-9d7b-11e2-8070-49715e847bda:1-40721635<\/code><\/p>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0441\u0431\u0440\u043e\u0441 <strong>slav&#8217;a<\/strong> \u0432 \u043a\u0430\u043d\u0430\u043b\u0435 <strong>master2<\/strong>:<\/p>\n<p><code>mysql&gt;reset slave for channel 'master2';<\/code><\/p>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0441\u0431\u0440\u043e\u0441 \u043c\u0430\u0441\u0442\u0435\u0440\u0430:<\/p>\n<p><code>mysql&gt;reset master;<\/code><\/p>\n<p>\u0414\u0435\u043b\u0430\u0435\u043c <strong>gtid_purge<\/strong> (\u0447\u0442\u043e \u0431\u044b <strong>slave<\/strong> \u0437\u043d\u0430\u043b \u0441 \u043a\u0430\u043a\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043f\u043e\u0438\u0441\u043a) \u043d\u043e \u0442\u0430\u043a, \u0447\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0435\u0449\u0451 <strong>ID<\/strong> \u043c\u0430\u0441\u0442\u0435\u0440\u0430 <strong>master2<\/strong> (\u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 <strong>gtid_purge<\/strong> \u043e\u0431\u0449\u0438\u0439 \u0434\u043b\u044f \u0432\u0441\u0435\u0445, \u0442\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0435\u0433\u043e \u0434\u043b\u044f \u043a\u0430\u043d\u0430\u043b\u0430 \u043d\u0435\u043b\u044c\u0437\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u0434\u0430\u0451\u043c \u043e\u0431\u0449\u0438\u0439, \u0441 \u0443\u0447\u0451\u0442\u043e\u043c \u0432\u0441\u0435\u0445 <strong>ID<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438). \u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p><code>mysql&gt;set global GTID_PURGED='1136d9c4-0ecf-11e5-be7e-28d2445d8ed0:1-383562252,<br \/>\n53d58b0f-eb6f-11e6-9215-392e3ca483a1:1-1095535,<br \/>\n82ad4575-4739-11e6-a34c-8a4ad13bb2ca:1-57542,<br \/>\nbcdd5c11-9d7b-11e2-8070-49715e847bda:1-40721635<br \/>\n<span style=\"color: #ff0000;\">10a3410d-e30a-11e6-b657-bfec5e13431a:1-1073549'<\/span>;<\/code><\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0441\u0442\u0440\u043e\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <strong>ID<\/strong> \u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u0435\u0439 <strong>master2<\/strong>.<\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0432\u0441\u0435 <strong>slav&#8217;\u044b<\/strong>:<\/p>\n<p><code>mysql&gt;start slave;<\/code><\/p>\n<p>\u0430 \u0442\u0430\u043a \u0436\u0435 \u043f\u0440\u0438\u043d\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u043e\u0432\u044b\u0439 \u043a\u0430\u043d\u0430\u043b \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438 (\u043e\u043d \u043d\u0435 \u043f\u043e\u0434\u043d\u0438\u043c\u0435\u0442\u0441\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u0434\u043e \u044d\u0442\u043e\u0433\u043e \u0431\u044b\u043b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u043e\u0448\u0438\u0431\u043a\u043e\u0439 <strong>1236<\/strong>):<\/p>\n<p><code>mysql&gt;start slave for channel 'master2';<\/code><\/p>\n<p><span style=\"color: #ff6600;\"><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435.<\/strong><\/span><\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0435 \u0435\u0449\u0451 \u043e\u0434\u0438\u043d <strong>master<\/strong>, \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u0436\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u043d\u0430 <strong>slav&#8217;e<\/strong> \u0438 \u0443 \u0432\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u0435 (\u0434\u0435\u0441\u044f\u0442\u043a\u0438, \u0441\u043e\u0442\u043d\u0438 \u0442\u044b\u0441\u044f\u0447 \u0441\u0435\u043a\u0443\u043d\u0434)\u00a0\u0446\u0438\u0444\u0440\u044b \u043f\u043e \u043e\u0442\u0441\u0442\u0430\u0432\u0430\u043d\u0438\u044e \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0445\u0430\u043a:<\/p>\n<p><code>mysql&gt;stop slave for channel 'master2';<br \/>\nmysql&gt;reset slave for channel 'master2';<br \/>\nmysql&gt;start slave for channel 'master2';<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0418 \u0442\u0430\u043a, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c \u0441\u0435\u0431\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e: \u0435\u0441\u0442\u044c GTID \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u0438 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u043a\u0430\u043d\u0430\u043b \u0441 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043c\u0430\u0441\u0442\u0435\u0440\u0430. \u0412\u0440\u043e\u0434\u0435 \u0431\u044b \u0438 \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430: change master to &#8230; channel master2, \u043d\u043e \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0430 \u043d\u043e\u0432\u043e\u043c \u043a\u0430\u043d\u0430\u043b\u0435 master2 \u043e\u043d\u0430 \u0441\u0432\u0430\u043b\u0438\u0442\u0441\u044f \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439: The slave is connecting using CHANGE MASTER TO MASTER_AUTO_POSITION = 1, but the master has [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-5192","post","type-post","status-publish","format-standard","hentry","category-databases"],"_links":{"self":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/5192","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5192"}],"version-history":[{"count":3,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/5192\/revisions"}],"predecessor-version":[{"id":5196,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/5192\/revisions\/5196"}],"wp:attachment":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5192"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5192"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5192"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}