10.5. Migrating Volumes
Note
replace-brick
operation, review the known issues related to replace-brick
operation in the Red Hat Gluster Storage 3.1 Release Notes.
10.5.1. Replacing a Subvolume on a Distribute or Distribute-replicate Volume Copy linkLink copied to clipboard!
- Add the new bricks to the volume.
gluster volume add-brick VOLNAME [replica <COUNT>] NEW-BRICK
# gluster volume add-brick VOLNAME [replica <COUNT>] NEW-BRICKgluster volume add-brick VOLNAME [replica <COUNT>] NEW-BRICKgluster volume add-brick VOLNAME [replica <COUNT>] NEW-BRICKgluster volume add-brick VOLNAME [replica <COUNT>] NEW-BRICK
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example 10.1. Adding a Brick to a Distribute Volume
gluster volume add-brick test-volume server5:/exp5
# gluster volume add-brick test-volume server5:/exp5 Add Brick successful
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Verify the volume information using the command:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Note
In case of a Distribute-replicate volume, you must specify the replica count in theadd-brick
command and provide the same number of bricks as the replica count to theadd-brick
command. - Remove the bricks to be replaced from the subvolume.
- Start the
remove-brick
operation using the command:gluster volume remove-brick VOLNAME [replica <COUNT>] <BRICK> start
# gluster volume remove-brick VOLNAME [replica <COUNT>] <BRICK> start# gluster volume remove-brick VOLNAME [replica <COUNT>] <BRICK> start# gluster volume remove-brick VOLNAME [replica <COUNT>] <BRICK> start
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example 10.2. Start a remove-brick operation on a distribute volume
gluster volume remove-brick test-volume server2:/exp2 start
# gluster volume remove-brick test-volume server2:/exp2 start Remove Brick start successful
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - View the status of the
remove-brick
operation using the command:gluster volume remove-brick VOLNAME [replica <COUNT>] BRICK status
# gluster volume remove-brick VOLNAME [replica <COUNT>] BRICK status# gluster volume remove-brick VOLNAME [replica <COUNT>] BRICK status# gluster volume remove-brick VOLNAME [replica <COUNT>] BRICK status# gluster volume remove-brick VOLNAME [replica <COUNT>] BRICK status# gluster volume remove-brick VOLNAME [replica <COUNT>] BRICK status
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example 10.3. View the Status of remove-brick Operation
gluster volume remove-brick test-volume server2:/exp2 status
# gluster volume remove-brick test-volume server2:/exp2 status Node Rebalanced-files size scanned failures status ------------------------------------------------------------------ server2 16 16777216 52 0 in progress
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Keep monitoring theremove-brick
operation status by executing the above command. When the value of the status field is set tocomplete
in the output ofremove-brick
status command, proceed further. - Commit the
remove-brick
operation using the command:gluster volume remove-brick VOLNAME [replica <COUNT>] <BRICK> commit
# gluster volume remove-brick VOLNAME [replica <COUNT>] <BRICK> commit# gluster volume remove-brick VOLNAME [replica <COUNT>] <BRICK> commit# gluster volume remove-brick VOLNAME [replica <COUNT>] <BRICK> commit
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example 10.4. Commit the remove-brick Operation on a Distribute Volume
gluster volume remove-brick test-volume server2:/exp2 commit
# gluster volume remove-brick test-volume server2:/exp2 commit
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Verify the volume information using the command:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Verify the content on the brick after committing the
remove-brick
operation on the volume. If there are any files leftover, copy it through FUSE or NFS mount.- Verify if there are any pending files on the bricks of the subvolume.Along with files, all the application-specific extended attributes must be copied. glusterFS also uses extended attributes to store its internal data. The extended attributes used by glusterFS are of the form
trusted.glusterfs.*
,trusted.afr.*
, andtrusted.gfid
. Any extended attributes other than ones listed above must also be copied.To copy the application-specific extended attributes and to achieve a an effect similar to the one that is described above, use the following shell script:Syntax:copy.sh <glusterfs-mount-point> <brick>
# copy.sh <glusterfs-mount-point> <brick>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example 10.5. Code Snippet Usage
If the mount point is/mnt/glusterfs
and brick path is/export/brick1
, then the script must be run as:copy.sh /mnt/glusterfs /export/brick
# copy.sh /mnt/glusterfs /export/brick
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Copy to Clipboard Copied! Toggle word wrap Toggle overflow - To identify a list of files that are in a split-brain state, execute the command:
gluster volume heal test-volume info split-brain
# gluster volume heal test-volume info split-brain
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - If there are any files listed in the output of the above command, compare the files across the bricks in a replica set, delete the bad files from the brick and retain the correct copy of the file. Manual intervention by the System Administrator would be required to choose the correct copy of file.
10.5.2. Replacing an Old Brick with a New Brick on a Replicate or Distribute-replicate Volume Copy linkLink copied to clipboard!
- Ensure that the new brick (
sys5:/home/gfs/r2_5
) that replaces the old brick (sys0:/home/gfs/r2_0
) is empty. Ensure that all the bricks are online. The brick that must be replaced can be in an offline state. - Execute the
replace-brick
command with theforce
option:gluster volume replace-brick r2 sys0:/home/gfs/r2_0 sys5:/home/gfs/r2_5 commit force
# gluster volume replace-brick r2 sys0:/home/gfs/r2_0 sys5:/home/gfs/r2_5 commit force volume replace-brick: success: replace-brick commit successful
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Check if the new brick is online.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Ensure that after the self-heal completes, the extended attributes are set to zero on the other bricks in the replica.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Note that in this example, the extended attributestrusted.afr.r2-client-0
andtrusted.afr.r2-client-1
are set to zero.
10.5.3. Replacing an Old Brick with a New Brick on a Distribute Volume Copy linkLink copied to clipboard!
Important
- Replace a brick with a commit
force
option:gluster volume replace-brick VOLNAME <BRICK> <NEW-BRICK> commit force
# gluster volume replace-brick VOLNAME <BRICK> <NEW-BRICK> commit force# gluster volume replace-brick VOLNAME <BRICK> <NEW-BRICK> commit force# gluster volume replace-brick VOLNAME <BRICK> <NEW-BRICK> commit force
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example 10.6. Replace a brick on a Distribute Volume
gluster volume replace-brick r2 sys0:/home/gfs/r2_0 sys5:/home/gfs/r2_5 commit force
# gluster volume replace-brick r2 sys0:/home/gfs/r2_0 sys5:/home/gfs/r2_5 commit force volume replace-brick: success: replace-brick commit successful
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Verify if the new brick is online.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Note
replace-brick
command options except the commit force
option are deprecated.