<div dir="ltr">On Thu, Oct 3, 2013 at 8:57 AM, KueiHuan Chen <span dir="ltr">&lt;<a href="mailto:kueihuan.chen@gmail.com" target="_blank">kueihuan.chen@gmail.com</a>&gt;</span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi, Avati<br>
<br>
  In your chained configuration, how to replace whole h1 without<br>
replace-brick ? Is there has a better way than replace brick in this<br>
situation ?<br>
<br>
  h0:/b1 h1:/b2 h1:/b1 h2:/b2 h2:/b1 h0:/b2 (A new h3 want to replace old h1.)<br></blockquote><div><br></div><div><br></div><div>You have a couple of options,</div><div><br></div><div>A)</div><div><br></div><div>replace-brick h1:/b1 h3:/b1</div>
<div>replace-brick h1:/b2 h3:/b2</div><div><br></div><div>and let self-heal bring the disks up to speed, or</div><div><br></div><div>B)</div><div><br></div><div>add-brick replica 2 h3:/b1 h2:/b2a</div><div>add-brick replica 2 h3:/b2 h0:/b1a</div>
<div><br></div><div>remove-brick h0:/b1 h1:/b2 start .. commit</div><div>remove-brick h2:/b2 h1:/b1 start .. commit</div><div><br></div><div>Let me know if you still have questions.</div><div><br></div><div>Avati</div><div>
<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Thanks.<br>
Best Regards,<br>
<br>
KueiHuan-Chen<br>
Synology Incorporated.<br>
Email: <a href="mailto:khchen@synology.com">khchen@synology.com</a><br>
Tel: <a href="tel:%2B886-2-25521814%20ext.827" value="+886225521814">+886-2-25521814 ext.827</a><br>
<br>
<br>
2013/9/30 Anand Avati &lt;<a href="mailto:avati@gluster.org">avati@gluster.org</a>&gt;:<br>
<div class="HOEnZb"><div class="h5">&gt;<br>
&gt;<br>
&gt;<br>
&gt; On Fri, Sep 27, 2013 at 1:56 AM, James &lt;<a href="mailto:purpleidea@gmail.com">purpleidea@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; On Fri, 2013-09-27 at 00:35 -0700, Anand Avati wrote:<br>
&gt;&gt; &gt; Hello all,<br>
&gt;&gt; Hey,<br>
&gt;&gt;<br>
&gt;&gt; Interesting timing for this post...<br>
&gt;&gt; I&#39;ve actually started working on automatic brick addition/removal. (I&#39;m<br>
&gt;&gt; planning to add this to puppet-gluster of course.) I was hoping you<br>
&gt;&gt; could help out with the algorithm. I think it&#39;s a bit different if<br>
&gt;&gt; there&#39;s no replace-brick command as you are proposing.<br>
&gt;&gt;<br>
&gt;&gt; Here&#39;s the problem:<br>
&gt;&gt; Given a logically optimal initial volume:<br>
&gt;&gt;<br>
&gt;&gt; volA: rep=2; h1:/b1 h2:/b1 h3:/b1 h4:/b1 h1:/b2 h2:/b2 h3:/b2 h4:/b2<br>
&gt;&gt;<br>
&gt;&gt; suppose I know that I want to add/remove bricks such that my new volume<br>
&gt;&gt; (if I had created it new) looks like:<br>
&gt;&gt;<br>
&gt;&gt; volB: rep=2; h1:/b1 h3:/b1 h4:/b1 h5:/b1 h6:/b1 h1:/b2 h3:/b2 h4:/b2<br>
&gt;&gt; h5:/b2 h6:/b2<br>
&gt;&gt;<br>
&gt;&gt; What is the optimal algorithm for determining the correct sequence of<br>
&gt;&gt; transforms that are needed to accomplish this task. Obviously there are<br>
&gt;&gt; some simpler corner cases, but I&#39;d like to solve the general case.<br>
&gt;&gt;<br>
&gt;&gt; The transforms are obviously things like running the add-brick {...} and<br>
&gt;&gt; remove-brick {...} commands.<br>
&gt;&gt;<br>
&gt;&gt; Obviously we have to take into account that it&#39;s better to add bricks<br>
&gt;&gt; and rebalance before we remove bricks and risk the file system if a<br>
&gt;&gt; replica is missing. The algorithm should work for any replica N. We want<br>
&gt;&gt; to make sure the new layout makes sense to replicate the data on<br>
&gt;&gt; different servers. In many cases, this will require creating a circular<br>
&gt;&gt; &quot;chain&quot; of bricks as illustrated in the bottom of this image:<br>
&gt;&gt; <a href="http://joejulian.name/media/uploads/images/replica_expansion.png" target="_blank">http://joejulian.name/media/uploads/images/replica_expansion.png</a><br>
&gt;&gt; for example. I&#39;d like to optimize for safety first, and then time, I<br>
&gt;&gt; imagine.<br>
&gt;&gt;<br>
&gt;&gt; Many thanks in advance.<br>
&gt;&gt;<br>
&gt;<br>
&gt; I see what you are asking. First of all, when running a 2-replica volume you<br>
&gt; almost pretty much always want to have an even number of servers, and add<br>
&gt; servers in even numbers. Ideally the two &quot;sides&quot; of the replicas should be<br>
&gt; placed in separate failures zones - separate racks with separate power<br>
&gt; supplies or separate AZs in the cloud. Having an odd number of servers with<br>
&gt; an 2 replicas is a very &quot;odd&quot; configuration. In all these years I am yet to<br>
&gt; come across a customer who has a production cluster with 2 replicas and an<br>
&gt; odd number of servers. And setting up replicas in such a chained manner<br>
&gt; makes it hard to reason about availability, especially when you are trying<br>
&gt; recover from a disaster. Having clear and separate &quot;pairs&quot; is definitely<br>
&gt; what is recommended.<br>
&gt;<br>
&gt; That being said, nothing prevents one from setting up a chain like above as<br>
&gt; long as you are comfortable with the complexity of the configuration. And<br>
&gt; phasing out replace-brick in favor of add-brick/remove-brick does not make<br>
&gt; the above configuration impossible either. Let&#39;s say you have a chained<br>
&gt; configuration of N servers, with pairs formed between every:<br>
&gt;<br>
&gt; h(i):/b1 h((i+1) % N):/b2 | i := 0 -&gt; N-1<br>
&gt;<br>
&gt; Now you add N+1th server.<br>
&gt;<br>
&gt; Using replace-brick, you have been doing thus far:<br>
&gt;<br>
&gt; 1. add-brick hN:/b1 h0:/b2a # because h0:/b2 was &quot;part of a previous brick&quot;<br>
&gt; 2. replace-brick h0:/b2 hN:/b2 start ... commit<br>
&gt;<br>
&gt; In case you are doing an add-brick/remove-brick approach, you would now<br>
&gt; instead do:<br>
&gt;<br>
&gt; 1. add-brick h(N-1):/b1a hN:/b2<br>
&gt; 2. add-brick hN:/b1 h0:/b2a<br>
&gt; 3. remove-brick h(N-1):/b1 h0:/b2 start ... commit<br>
&gt;<br>
&gt; You will not be left with only 1 copy of a file at any point in the process,<br>
&gt; and achieve the same &quot;end result&quot; as you were with replace-brick. As<br>
&gt; mentioned before, I once again request you to consider if you really want to<br>
&gt; deal with the configuration complexity of having chained replication,<br>
&gt; instead of just adding servers in pairs.<br>
&gt;<br>
&gt; Please ask if there are any more questions or concerns.<br>
&gt;<br>
&gt; Avati<br>
&gt;<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt; James<br>
&gt;&gt;<br>
&gt;&gt; Some comments below, although I&#39;m a bit tired so I hope I said it all<br>
&gt;&gt; right.<br>
&gt;&gt;<br>
&gt;&gt; &gt; DHT&#39;s remove-brick + rebalance has been enhanced in the last couple of<br>
&gt;&gt; &gt; releases to be quite sophisticated. It can handle graceful<br>
&gt;&gt; &gt; decommissioning<br>
&gt;&gt; &gt; of bricks, including open file descriptors and hard links.<br>
&gt;&gt; Sweet<br>
&gt;&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; This in a way is a feature overlap with replace-brick&#39;s data migration<br>
&gt;&gt; &gt; functionality. Replace-brick&#39;s data migration is currently also used for<br>
&gt;&gt; &gt; planned decommissioning of a brick.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Reasons to remove replace-brick (or why remove-brick is better):<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; - There are two methods of moving data. It is confusing for the users<br>
&gt;&gt; &gt; and<br>
&gt;&gt; &gt; hard for developers to maintain.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; - If server being replaced is a member of a replica set, neither<br>
&gt;&gt; &gt; remove-brick nor replace-brick data migration is necessary, because<br>
&gt;&gt; &gt; self-healing itself will recreate the data (replace-brick actually uses<br>
&gt;&gt; &gt; self-heal internally)<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; - In a non-replicated config if a server is getting replaced by a new<br>
&gt;&gt; &gt; one,<br>
&gt;&gt; &gt; add-brick &lt;new&gt; + remove-brick &lt;old&gt; &quot;start&quot; achieves the same goal as<br>
&gt;&gt; &gt; replace-brick &lt;old&gt; &lt;new&gt; &quot;start&quot;.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; - In a non-replicated config, &lt;replace-brick&gt; is NOT glitch free<br>
&gt;&gt; &gt; (applications witness ENOTCONN if they are accessing data) whereas<br>
&gt;&gt; &gt; add-brick &lt;new&gt; + remove-brick &lt;old&gt; is completely transparent.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; - Replace brick strictly requires a server with enough free space to<br>
&gt;&gt; &gt; hold<br>
&gt;&gt; &gt; the data of the old brick, whereas remove-brick will evenly spread out<br>
&gt;&gt; &gt; the<br>
&gt;&gt; &gt; data of the bring being removed amongst the remaining servers.<br>
&gt;&gt;<br>
&gt;&gt; Can you talk more about the replica = N case (where N is 2 or 3?)<br>
&gt;&gt; With remove brick, add brick you will need add/remove N (replica count)<br>
&gt;&gt; bricks at a time, right? With replace brick, you could just swap out<br>
&gt;&gt; one, right? Isn&#39;t that a missing feature if you remove replace brick?<br>
&gt;&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; - Replace-brick code is complex and messy (the real reason :p).<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; - No clear reason why replace-brick&#39;s data migration is better in any<br>
&gt;&gt; &gt; way<br>
&gt;&gt; &gt; to remove-brick&#39;s data migration.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; I plan to send out patches to remove all traces of replace-brick data<br>
&gt;&gt; &gt; migration code by 3.5 branch time.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; NOTE that replace-brick command itself will still exist, and you can<br>
&gt;&gt; &gt; replace on server with another in case a server dies. It is only the<br>
&gt;&gt; &gt; data<br>
&gt;&gt; &gt; migration functionality being phased out.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Please do ask any questions / raise concerns at this stage :)<br>
&gt;&gt; I heard with 3.4 you can somehow change the replica count when adding<br>
&gt;&gt; new bricks... What&#39;s the full story here please?<br>
&gt;&gt;<br>
&gt;&gt; Thanks!<br>
&gt;&gt; James<br>
&gt;&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Avati<br>
&gt;&gt; &gt; _______________________________________________<br>
&gt;&gt; &gt; Gluster-users mailing list<br>
&gt;&gt; &gt; <a href="mailto:Gluster-users@gluster.org">Gluster-users@gluster.org</a><br>
&gt;&gt; &gt; <a href="http://supercolony.gluster.org/mailman/listinfo/gluster-users" target="_blank">http://supercolony.gluster.org/mailman/listinfo/gluster-users</a><br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Gluster-users mailing list<br>
&gt; <a href="mailto:Gluster-users@gluster.org">Gluster-users@gluster.org</a><br>
&gt; <a href="http://supercolony.gluster.org/mailman/listinfo/gluster-users" target="_blank">http://supercolony.gluster.org/mailman/listinfo/gluster-users</a><br>
</div></div></blockquote></div><br></div></div>