{"id":7119,"date":"2014-11-10T07:56:58","date_gmt":"2014-11-10T05:56:58","guid":{"rendered":"http:\/\/code.openark.org\/blog\/?p=7119"},"modified":"2014-11-10T07:56:58","modified_gmt":"2014-11-10T05:56:58","slug":"semi-automatic-slavemaster-promotion-via-pseudo-gtid","status":"publish","type":"post","link":"https:\/\/code.openark.org\/blog\/mysql\/semi-automatic-slavemaster-promotion-via-pseudo-gtid","title":{"rendered":"Semi-automatic slave\/master promotion via Pseudo GTID"},"content":{"rendered":"<p><a href=\"https:\/\/github.com\/outbrain\/orchestrator\">Orchestrator<\/a> release <a href=\"https:\/\/github.com\/outbrain\/orchestrator\/releases\">1.2.7-beta<\/a> now supports semi-automatic slave promotion to master upon master death, via <a href=\"code.openark.org\/blog\/mysql\/refactoring-replication-topology-with-pseudo-gtid\">Pseudo GTID<\/a>.<\/p>\n<blockquote><p><a href=\"http:\/\/code.openark.org\/blog\/wp-content\/uploads\/2014\/10\/orchestrator-make-master-highlighted.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-7150\" src=\"http:\/\/code.openark.org\/blog\/wp-content\/uploads\/2014\/10\/orchestrator-make-master-highlighted.png\" alt=\"orchestrator-make-master-highlighted\" width=\"809\" height=\"363\" srcset=\"https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2014\/10\/orchestrator-make-master-highlighted.png 809w, https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2014\/10\/orchestrator-make-master-highlighted-300x134.png 300w\" sizes=\"auto, (max-width: 809px) 100vw, 809px\" \/><\/a><\/p><\/blockquote>\n<p>When the master is dead, <em>orchestrator<\/em> automatically picks the most up-to-date slaves and marks them as <strong>&#8220;Master candidates&#8221;<\/strong>. It allows a <strong>\/api\/make-master<\/strong> call on such a slave (S), in which case it uses <a href=\"http:\/\/code.openark.org\/blog\/mysql\/refactoring-replication-topology-with-pseudo-gtid\">Pseudo GTID<\/a> to enslave its siblings, and set S as <strong>read-only = 0<\/strong>. All we need to do is click the <strong>&#8220;Make master&#8221;<\/strong> button.<!--more--><\/p>\n<blockquote><p><a href=\"http:\/\/code.openark.org\/blog\/wp-content\/uploads\/2014\/10\/orchestrator-make-master-confirm1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-7145\" src=\"http:\/\/code.openark.org\/blog\/wp-content\/uploads\/2014\/10\/orchestrator-make-master-confirm1.png\" alt=\"orchestrator-make-master-confirm\" width=\"946\" height=\"367\" srcset=\"https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2014\/10\/orchestrator-make-master-confirm1.png 946w, https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2014\/10\/orchestrator-make-master-confirm1-300x116.png 300w, https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2014\/10\/orchestrator-make-master-confirm1-900x349.png 900w\" sizes=\"auto, (max-width: 946px) 100vw, 946px\" \/><\/a><\/p><\/blockquote>\n<p>Yes, <strong>&#8220;OK&#8221;<\/strong>. A moment later:<\/p>\n<blockquote><p><a href=\"http:\/\/code.openark.org\/blog\/wp-content\/uploads\/2014\/10\/orchestrator-make-master-refactored1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-7146\" src=\"http:\/\/code.openark.org\/blog\/wp-content\/uploads\/2014\/10\/orchestrator-make-master-refactored1-1024x256.png\" alt=\"orchestrator-make-master-refactored\" width=\"1024\" height=\"256\" srcset=\"https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2014\/10\/orchestrator-make-master-refactored1-1024x256.png 1024w, https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2014\/10\/orchestrator-make-master-refactored1-300x75.png 300w, https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2014\/10\/orchestrator-make-master-refactored1-900x225.png 900w, https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2014\/10\/orchestrator-make-master-refactored1.png 1098w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/p><\/blockquote>\n<p>See how the two slaves <strong>22988<\/strong>, <strong>22989<\/strong> are happily replicating from <strong>22990<\/strong>. Turning them into <strong>22990<\/strong>&#8216;s slave was possible even though their shared master was dead and were stopped at different replication positions.<\/p>\n<p><strong>22990<\/strong> is now writeable, and its on you to disconnect from its old master and to direct your application into this newly promoted instance.<\/p>\n<h4>Local master promotion<\/h4>\n<p>Likewise, a semi-automated solution for the corruption of a local master is in place. Consider the following, where <strong>22989<\/strong> is dead\/inaccessible. <strong>22988<\/strong> and <strong>22990<\/strong> are stuck in replication:<\/p>\n<blockquote><p><a href=\"http:\/\/code.openark.org\/blog\/wp-content\/uploads\/2014\/11\/orchestrator-make-local-master.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-7164\" src=\"http:\/\/code.openark.org\/blog\/wp-content\/uploads\/2014\/11\/orchestrator-make-local-master-1024x263.png\" alt=\"orchestrator-make-local-master\" width=\"1024\" height=\"263\" srcset=\"https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2014\/11\/orchestrator-make-local-master-1024x263.png 1024w, https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2014\/11\/orchestrator-make-local-master-300x77.png 300w, https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2014\/11\/orchestrator-make-local-master-900x231.png 900w, https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2014\/11\/orchestrator-make-local-master.png 1094w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/p><\/blockquote>\n<p><em>Orchestrator<\/em> detects this situation and picks the most up-to-date slave, marking it as candidate for promotion. Click <strong>&#8220;Make lock master&#8221;<\/strong> to get:<\/p>\n<blockquote><p><a href=\"http:\/\/code.openark.org\/blog\/wp-content\/uploads\/2014\/11\/orchestrator-make-local-master-confirm.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-7165\" src=\"http:\/\/code.openark.org\/blog\/wp-content\/uploads\/2014\/11\/orchestrator-make-local-master-confirm-1024x257.png\" alt=\"orchestrator-make-local-master-confirm\" width=\"1024\" height=\"257\" srcset=\"https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2014\/11\/orchestrator-make-local-master-confirm-1024x257.png 1024w, https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2014\/11\/orchestrator-make-local-master-confirm-300x75.png 300w, https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2014\/11\/orchestrator-make-local-master-confirm-900x226.png 900w, https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2014\/11\/orchestrator-make-local-master-confirm.png 1075w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/p><\/blockquote>\n<p>Sure, OK:<\/p>\n<blockquote><p><a href=\"http:\/\/code.openark.org\/blog\/wp-content\/uploads\/2014\/11\/orchestrator-make-local-master-refactored.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-7166\" src=\"http:\/\/code.openark.org\/blog\/wp-content\/uploads\/2014\/11\/orchestrator-make-local-master-refactored-1024x276.png\" alt=\"orchestrator-make-local-master-refactored\" width=\"1024\" height=\"276\" srcset=\"https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2014\/11\/orchestrator-make-local-master-refactored-1024x276.png 1024w, https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2014\/11\/orchestrator-make-local-master-refactored-300x80.png 300w, https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2014\/11\/orchestrator-make-local-master-refactored-900x242.png 900w, https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2014\/11\/orchestrator-make-local-master-refactored.png 1064w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/p><\/blockquote>\n<p>And now <strong>22990<\/strong> takes over instead of <strong>22989<\/strong>, enslaving <strong>22988<\/strong>, both running happily ever after.<\/p>\n<h4>\u00a0Automation<\/h4>\n<p>The above buttons are just convenience methods. You don&#8217;t strictly need visualization\/GUI for that. Everything is supported by the API, and can be used by a fully automated monitoring system. More to come in <em>orchestrator<\/em>.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Orchestrator release 1.2.7-beta now supports semi-automatic slave promotion to master upon master death, via Pseudo GTID. When the master is dead, orchestrator automatically picks the most up-to-date slaves and marks them as &#8220;Master candidates&#8221;. It allows a \/api\/make-master call on such a slave (S), in which case it uses Pseudo GTID to enslave its siblings, [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"enabled":false},"version":2}},"categories":[5],"tags":[108,115,8],"class_list":["post-7119","post","type-post","status-publish","format-standard","hentry","category-mysql","tag-orchestrator","tag-pseudo-gtid","tag-replication"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2bZZp-1QP","_links":{"self":[{"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/posts\/7119","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/comments?post=7119"}],"version-history":[{"count":14,"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/posts\/7119\/revisions"}],"predecessor-version":[{"id":7170,"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/posts\/7119\/revisions\/7170"}],"wp:attachment":[{"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/media?parent=7119"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/categories?post=7119"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/tags?post=7119"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}