<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    hi,<br>
    Steps for replace-brick:
    <br>
    0) Make sure the new brick is empty before replace-brick.<br>
    1) Check that all the bricks are running. It is okay if the brick
    that is going to be replaced is down.
    <br>
    2) Bring the brick that is going to be replaced down if not already.
    <br>
        - Get the pid of the brick by executing 'gluster volume
    &lt;volname&gt; status'
    <br>
    <br>
    12:37:49 <span class="moz-smiley-s2" title=":("></span> ⚡ gluster
    volume status
    <br>
    Status of volume: r2
    <br>
    Gluster process                        Port    Online    Pid
    <br>
------------------------------------------------------------------------------
    <br>
    Brick pranithk-laptop:/home/gfs/r2_0            49152    Y    5342
    &lt;&lt;--- this is the brick we want to replace lets say.
    <br>
    Brick pranithk-laptop:/home/gfs/r2_1            49153    Y    5354
    <br>
    Brick pranithk-laptop:/home/gfs/r2_2            49154    Y    5365
    <br>
    Brick pranithk-laptop:/home/gfs/r2_3            49155    Y    5376
    <br>
    ....
    <br>
    <br>
        - Login to the machine where the brick is running and kill the
    brick.
    <br>
    <br>
    root@pranithk-laptop - /mnt/r2
    <br>
    12:38:33 <span class="moz-smiley-s2" title=":("></span> ⚡ kill -9
    5342
    <br>
    <br>
        - Confirm that the brick is not running anymore and the other
    bricks are running fine.
    <br>
    <br>
    12:38:38 <span class="moz-smiley-s1" title=":)"></span> ⚡ gluster
    volume status
    <br>
    Status of volume: r2
    <br>
    Gluster process                        Port    Online    Pid
    <br>
------------------------------------------------------------------------------
    <br>
    Brick pranithk-laptop:/home/gfs/r2_0            N/A    N    5342
    &lt;&lt;---- brick is not running, others are running fine.
    <br>
    Brick pranithk-laptop:/home/gfs/r2_1            49153    Y    5354
    <br>
    Brick pranithk-laptop:/home/gfs/r2_2            49154    Y    5365
    <br>
    Brick pranithk-laptop:/home/gfs/r2_3            49155    Y    5376
    <br>
    ....
    <br>
    <br>
    3) Set up metadata so that heal will happen from the other brick in
    replica pair to the one that is going to be replaced (In this case
    it is from /home/gfs/r2_1 -&gt; /home/gfs/r2_5):
    <br>
         - Create a directory on the mount point that doesn't already
    exist. Then delete that directory, do the same for metadata
    changelog by doing setfattr. This operation marks the pending
    changelog which will tell self-heal damon/mounts to perform
    self-heal from /home/gfs/r2_1 to /home/gfs/r2_5.
    <br>
    <br>
           mkdir /mnt/r2/&lt;name-of-nonexistent-dir&gt;
    <br>
           rmdir /mnt/r2/&lt;name-of-nonexistent-dir&gt;
    <br>
           setfattr -n trusted.non-existent-key -v abc /mnt/r2
    <br>
           setfattr -x trusted.non-existent-key  /mnt/r2
    <br>
           NOTE: '/mnt/r2' is the mount path.
    <br>
    <br>
        - Check that there are pending xattrs:
    <br>
    <br>
    getfattr -d -m. -e hex /home/gfs/r2_1
    <br>
    # file: home/gfs/r2_1
    <br>
security.selinux=0x756e636f6e66696e65645f753a6f626a6563745f723a66696c655f743a733000
    <br>
    trusted.afr.r2-client-0=0x000000000000000300000002 &lt;&lt;----
    xattrs are marked from source brick pranithk-laptop:/home/gfs/r2_1
    <br>
    trusted.afr.r2-client-1=0x000000000000000000000000
    <br>
    trusted.gfid=0x00000000000000000000000000000001
    <br>
    trusted.glusterfs.dht=0x0000000100000000000000007ffffffe
    <br>
    trusted.glusterfs.volume-id=0xde822e25ebd049ea83bfaa3c4be2b440
    <br>
    <br>
    3) Replace the brick with 'commit force' option
    <br>
    - Execute replace-brick command
    <br>
    <br>
    root@pranithk-laptop - /mnt/r2
    <br>
    12:58:46 <span class="moz-smiley-s1" title=":)"></span> ⚡ gluster
    volume replace-brick r2 `hostname`:/home/gfs/r2_0
    `hostname`:/home/gfs/r2_5 commit force
    <br>
    volume replace-brick: success: replace-brick commit successful
    <br>
    <br>
    - Check that the new brick is now online
    <br>
    root@pranithk-laptop - /mnt/r2
    <br>
    12:59:21 <span class="moz-smiley-s1" title=":)"></span> ⚡ gluster
    volume status
    <br>
    Status of volume: r2
    <br>
    Gluster process                        Port    Online    Pid
    <br>
------------------------------------------------------------------------------
    <br>
    Brick pranithk-laptop:/home/gfs/r2_5            49156    Y    5731
    &lt;&lt;&lt;---- new brick is online
    <br>
    Brick pranithk-laptop:/home/gfs/r2_1            49153    Y    5354
    <br>
    Brick pranithk-laptop:/home/gfs/r2_2            49154    Y    5365
    <br>
    Brick pranithk-laptop:/home/gfs/r2_3            49155    Y    5376
    <br>
    ...
    <br>
    <br>
    - Once self-heal completes the changelogs will be removed.
    <br>
    <br>
    12:59:27 <span class="moz-smiley-s1" title=":)"></span> ⚡ getfattr
    -d -m. -e hex /home/gfs/r2_1
    <br>
    getfattr: Removing leading '/' from absolute path names
    <br>
    # file: home/gfs/r2_1
    <br>
security.selinux=0x756e636f6e66696e65645f753a6f626a6563745f723a66696c655f743a733000
    <br>
    trusted.afr.r2-client-0=0x000000000000000000000000 &lt;&lt;----
    Pending changelogs are cleared.
    <br>
    trusted.afr.r2-client-1=0x000000000000000000000000
    <br>
    trusted.gfid=0x00000000000000000000000000000001
    <br>
    trusted.glusterfs.dht=0x0000000100000000000000007ffffffe
    <br>
    trusted.glusterfs.volume-id=0xde822e25ebd049ea83bfaa3c4be2b440
    <br>
    <br>
    Pranith
    <br>
    <br>
    <div class="moz-cite-prefix">On 07/25/2014 09:52 AM, 可樂我 wrote:<br>
    </div>
    <blockquote
cite="mid:CAD1my8voDZJiH1JgwUT2uGv7VLKLm8ECxYSX_DSW-tt9_7psdA@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>Hi everyone,<br>
            </div>
            I have a question about replace brick in glusterFS3.5<br>
          </div>
          if I want find a new brick in other node to replace old brick,<br>
        </div>
        <div>can I use the "gluster vol XXX replace-brick" cmd to
          replace brick?<br>
          <br>
        </div>
        <div>I find the information about replace brick in internet<br>
        </div>
        <div>it say:<br>
          <br
style="color:rgb(34,34,34);font-family:arial,sans-serif;line-height:normal;background-color:rgb(255,255,255)">
          <span
style="color:rgb(34,34,34);font-family:arial,sans-serif;line-height:normal;background-color:rgb(255,255,255)">When
            we initially came up with specs of 'glusterd', we needed an
            option to replace a dead brick, and few people even
            requested for
            having an option to migrate the data from the brick, when we
            are
            replacing it.</span><br
style="color:rgb(34,34,34);font-family:arial,sans-serif;line-height:normal;background-color:rgb(255,255,255)">
          <br
style="color:rgb(34,34,34);font-family:arial,sans-serif;line-height:normal;background-color:rgb(255,255,255)">
          <span
style="color:rgb(34,34,34);font-family:arial,sans-serif;line-height:normal;background-color:rgb(255,255,255)">The
            result of this is 'gluster volume replace-brick' CLI, and in
            the releases till 3.3.0 this was the only way to 'migrate'
            data off
            a removed brick properly.</span><br
style="color:rgb(34,34,34);font-family:arial,sans-serif;line-height:normal;background-color:rgb(255,255,255)">
          <br
style="color:rgb(34,34,34);font-family:arial,sans-serif;line-height:normal;background-color:rgb(255,255,255)">
          <span
style="color:rgb(34,34,34);font-family:arial,sans-serif;line-height:normal;background-color:rgb(255,255,255)">Now,
            with 3.3.0+ (ie, in upstream too), we have another *better*
            approach (technically), which is achieved by below
            methods<br>
            <br>
            <br>
          </span></div>
        <div><span
style="color:rgb(34,34,34);font-family:arial,sans-serif;line-height:normal;background-color:rgb(255,255,255)">So
            I can use the replace brick directly command?<br>
          </span></div>
        <div>
          <span
style="color:rgb(34,34,34);font-family:arial,sans-serif;line-height:normal;background-color:rgb(255,255,255)">have
            any method to replace brick in glusterFS without data lose?<br>
          </span></div>
        <div><span
style="color:rgb(34,34,34);font-family:arial,sans-serif;line-height:normal;background-color:rgb(255,255,255)">Any
            one can help me?<br>
          </span></div>
        <div><span
style="color:rgb(34,34,34);font-family:arial,sans-serif;line-height:normal;background-color:rgb(255,255,255)">Thanks
            a lot<br>
          </span></div>
        <div><span
style="color:rgb(34,34,34);font-family:arial,sans-serif;line-height:normal;background-color:rgb(255,255,255)"><br>
          </span></div>
        <div><span
style="color:rgb(34,34,34);font-family:arial,sans-serif;line-height:normal;background-color:rgb(255,255,255)"><br>
          </span></div>
        <div><br>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Gluster-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Gluster-users@gluster.org">Gluster-users@gluster.org</a>
<a class="moz-txt-link-freetext" href="http://supercolony.gluster.org/mailman/listinfo/gluster-users">http://supercolony.gluster.org/mailman/listinfo/gluster-users</a></pre>
    </blockquote>
    <br>
  </body>
</html>