{"id":7347,"date":"2015-09-02T09:14:05","date_gmt":"2015-09-02T07:14:05","guid":{"rendered":"http:\/\/code.openark.org\/blog\/?p=7347"},"modified":"2015-09-02T09:14:05","modified_gmt":"2015-09-02T07:14:05","slug":"orchestrator-visual-cheatsheet-tldr-the-smart-way","status":"publish","type":"post","link":"https:\/\/code.openark.org\/blog\/mysql\/orchestrator-visual-cheatsheet-tldr-the-smart-way","title":{"rendered":"Orchestrator visual cheatsheet, TL;DR the &#8220;smart&#8221; way"},"content":{"rendered":"<p><strong><a href=\"https:\/\/github.com\/outbrain\/orchestrator\">Orchestrator<\/a><\/strong> is <em>really<\/em> growing. And the amount of users (DBAs, sys admins) using it is growing. Which gives me a lot of\u00a0immediate feedback in the form of <em>&#8220;Look, there&#8217;s just too many options to move slaves around! Which ones should\u00a0we use?&#8221;<\/em><\/p>\n<h3>TL;DR look at the two\u00a0visualized commands below<\/h3>\n<p>They are enough<\/p>\n<h3>The &#8220;smart&#8221; commands to end all commands<\/h3>\n<p>So all relocation commands are important, and give you fine-grained, pin-pointed control of the method of topology refactoring. However, most of the time you <em>just want to move those servers around<\/em>. Which is why there&#8217;s a new &#8220;smart&#8221; mode which support these two commands, which you should be happy using:<\/p>\n<ul>\n<li><strong>relocate<\/strong>: move a single slave to another position<\/li>\n<li><strong>relocate-slaves<\/strong>: move all\/some slaves of some server to another position.<\/li>\n<\/ul>\n<p>What makes these commands Smart? You can move slaves around from <em>anywhere<\/em> to <em>anywhere<\/em>. And <em>orchestrator<\/em> figures out the bast execution path. If possible, it uses GTID. Not possible? Is Pseudo-GTID available? Great, using Pseudo-GTID. Oh, are there binlog servers involved? Really simple, use them. None of the above? <em>Orchestrator<\/em> will use &#8220;standard&#8221; binlog file:pos math (with limitations). <em>Orchestrator<\/em> will even figure out if multiple steps are necessary and will combine any of the above.<\/p>\n<p>So you don&#8217;t have to remember\u00a0all the possible ways and options. The visual cheatsheet now boils down to these two:<\/p>\n<blockquote><p><a href=\"http:\/\/code.openark.org\/blog\/wp-content\/uploads\/2015\/08\/orchestrator-cheatsheet-visualized-relocate.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-7357\" src=\"http:\/\/code.openark.org\/blog\/wp-content\/uploads\/2015\/08\/orchestrator-cheatsheet-visualized-relocate.png\" alt=\"orchestrator-cheatsheet-visualized-relocate\" width=\"720\" height=\"405\" srcset=\"https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2015\/08\/orchestrator-cheatsheet-visualized-relocate.png 720w, https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2015\/08\/orchestrator-cheatsheet-visualized-relocate-300x169.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/code.openark.org\/blog\/wp-content\/uploads\/2015\/08\/orchestrator-cheatsheet-visualized-relocate-slaves.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-7350\" src=\"http:\/\/code.openark.org\/blog\/wp-content\/uploads\/2015\/08\/orchestrator-cheatsheet-visualized-relocate-slaves.png\" alt=\"orchestrator-cheatsheet-visualized-relocate-slaves\" width=\"720\" height=\"405\" srcset=\"https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2015\/08\/orchestrator-cheatsheet-visualized-relocate-slaves.png 720w, https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2015\/08\/orchestrator-cheatsheet-visualized-relocate-slaves-300x169.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p><\/blockquote>\n<p>Let&#8217;s take a slightly deeper look<!--more--><\/p>\n<h3>relocate<\/h3>\n<p>Moves a single slave <strong>X<\/strong> from any point to replicate another some server <strong>Z<\/strong><\/p>\n<ul>\n<li>As usual, <em>orchestrator<\/em> first confirms that <strong>X<\/strong> <em>can<\/em> replicate from <strong>Z<\/strong> (<strong>Z<\/strong> has <strong>log-slave-updates<\/strong> or is a binlog server; binlog format compatible, etc.)<\/li>\n<li>With GTID\/Pseudo-GTID, move from any point to any point<\/li>\n<li>With binlog servers, move around the binlog server environment (at this point you are not using binlog servers, so ignore)<\/li>\n<li>With normal replication, requires an &#8220;atomic&#8221; operation: either move the slave one level up, or make it replicate from a sibling.<\/li>\n<li>You can <em>relocate<\/em> the same master, effectively repointing the slave back to its existing position. This serves to re-resolve master hostname; to reset\u00a0relay logs; to verify slave is aligned with master.<\/li>\n<li>Or combination of the above<\/li>\n<\/ul>\n<h3>relocate-slaves<\/h3>\n<p>Moves multiple slaves of server <strong>X<\/strong> to replicate from some other server <strong>W<\/strong><\/p>\n<ul>\n<li>By default moves all slaves of <strong>X<\/strong>, where possible<\/li>\n<li>Each slave\u00a0verified to be able to replicate from <strong>W<\/strong>. Those that can&#8217;t are left behind.<\/li>\n<li>Can filter using regular expression via <strong>&#8211;pattern=some?[reg]ex<\/strong> on slave hostnames<\/li>\n<li>Can relocate under same master, effectively repointing all slaves (see above explanation)<\/li>\n<li>Can relocate below one of the very slaves of X. If Y is in itself a slave of X and you&#8217;re executing:<br \/>\n<strong>orchestrator -c relocate-slaves -i X -d Y<\/strong><br \/>\nthen <strong>Y<\/strong> is excluded\u00a0from the list of relocated slaves. This effectively means &#8220;make <strong>Y<\/strong> local master of its current siblings&#8221;. Very cool stuff.<\/li>\n<li>When binlog servers involved, simple math-less repointing takes place<\/li>\n<li>When GTID involved, let MySQL\/MariaDB (both supported) do the math on a per-server basis<\/li>\n<li>When Pseudo-GTID involved, <em>greatly<\/em> optimize by dividing into <a href=\"https:\/\/en.wikipedia.org\/wiki\/Equivalence_class\">equivalence classes<\/a> and only doing the math on a representative of each class.<\/li>\n<li>Or combination of the above<\/li>\n<\/ul>\n<h3>What about the other commands?<\/h3>\n<p>The above covers such commands as <strong>move-up<\/strong>, <strong>move-below<\/strong>, <strong>repoint<\/strong>, <strong>repoint-slaves<\/strong>, <strong>match-below<\/strong>, <strong>multi-match-slaves<\/strong>, <strong>regroup-slaves<\/strong> and more. It does not cover <strong>enslave-master<\/strong> and <strong>make-co-master<\/strong> which are a bit different.<\/p>\n<p>My guess is you can pass\u00a0<strong>98%<\/strong> of your operations\u00a0with <strong>relocate\u00a0<\/strong>and <strong>relocate-slaves<\/strong>. Otherwise just run <em>orchestrator<\/em> with no arguments nor options to get a full-blown breakdown of available commands.<\/p>\n<h3>GUI drag-n-drop<\/h3>\n<p><strong>relocate-slaves<\/strong> is achieved by dragging the slaves of an instance on top of a new master, as follows:<\/p>\n<blockquote><p><a href=\"http:\/\/code.openark.org\/blog\/wp-content\/uploads\/2015\/08\/orchestrator-relocate-slaves-before.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-7372\" src=\"http:\/\/code.openark.org\/blog\/wp-content\/uploads\/2015\/08\/orchestrator-relocate-slaves-before.png\" alt=\"orchestrator-relocate-slaves-before\" width=\"994\" height=\"369\" srcset=\"https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2015\/08\/orchestrator-relocate-slaves-before.png 994w, https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2015\/08\/orchestrator-relocate-slaves-before-300x111.png 300w, https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2015\/08\/orchestrator-relocate-slaves-before-900x334.png 900w\" sizes=\"auto, (max-width: 994px) 100vw, 994px\" \/><\/a><a href=\"http:\/\/code.openark.org\/blog\/wp-content\/uploads\/2015\/08\/orchestrator-relocate-slaves-hover.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-7373\" src=\"http:\/\/code.openark.org\/blog\/wp-content\/uploads\/2015\/08\/orchestrator-relocate-slaves-hover.png\" alt=\"orchestrator-relocate-slaves-hover\" width=\"996\" height=\"339\" srcset=\"https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2015\/08\/orchestrator-relocate-slaves-hover.png 996w, https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2015\/08\/orchestrator-relocate-slaves-hover-300x102.png 300w, https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2015\/08\/orchestrator-relocate-slaves-hover-900x306.png 900w\" sizes=\"auto, (max-width: 996px) 100vw, 996px\" \/><\/a><a href=\"http:\/\/code.openark.org\/blog\/wp-content\/uploads\/2015\/08\/orchestrator-relocate-slaves-drag1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-7377\" src=\"http:\/\/code.openark.org\/blog\/wp-content\/uploads\/2015\/08\/orchestrator-relocate-slaves-drag1.png\" alt=\"orchestrator-relocate-slaves-drag\" width=\"980\" height=\"363\" srcset=\"https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2015\/08\/orchestrator-relocate-slaves-drag1.png 980w, https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2015\/08\/orchestrator-relocate-slaves-drag1-300x111.png 300w, https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2015\/08\/orchestrator-relocate-slaves-drag1-900x333.png 900w\" sizes=\"auto, (max-width: 980px) 100vw, 980px\" \/><\/a><br \/>\n<a href=\"http:\/\/code.openark.org\/blog\/wp-content\/uploads\/2015\/08\/orchestrator-relocate-slaves-after.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-7375\" src=\"http:\/\/code.openark.org\/blog\/wp-content\/uploads\/2015\/08\/orchestrator-relocate-slaves-after.png\" alt=\"orchestrator-relocate-slaves-after\" width=\"993\" height=\"345\" srcset=\"https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2015\/08\/orchestrator-relocate-slaves-after.png 993w, https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2015\/08\/orchestrator-relocate-slaves-after-300x104.png 300w, https:\/\/code.openark.org\/blog\/wp-content\/uploads\/2015\/08\/orchestrator-relocate-slaves-after-900x313.png 900w\" sizes=\"auto, (max-width: 993px) 100vw, 993px\" \/><\/a><\/p><\/blockquote>\n<p>Find latest <em>orchestrator<\/em> release at\u00a0<a href=\"https:\/\/github.com\/outbrain\/orchestrator\/releases\">https:\/\/github.com\/outbrain\/orchestrator\/releases<\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Orchestrator is really growing. And the amount of users (DBAs, sys admins) using it is growing. Which gives me a lot of\u00a0immediate feedback in the form of &#8220;Look, there&#8217;s just too many options to move slaves around! Which ones should\u00a0we use?&#8221; TL;DR look at the two\u00a0visualized commands below They are enough The &#8220;smart&#8221; commands to [&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":[57,108,115,8],"class_list":["post-7347","post","type-post","status-publish","format-standard","hentry","category-mysql","tag-open-source","tag-orchestrator","tag-pseudo-gtid","tag-replication"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2bZZp-1Uv","_links":{"self":[{"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/posts\/7347","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=7347"}],"version-history":[{"count":14,"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/posts\/7347\/revisions"}],"predecessor-version":[{"id":7383,"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/posts\/7347\/revisions\/7383"}],"wp:attachment":[{"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/media?parent=7347"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/categories?post=7347"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/code.openark.org\/blog\/wp-json\/wp\/v2\/tags?post=7347"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}