Monday, December 19, 2016

Breaking up Huge volumes


                                              Breaking up Huge volumes

When volumes become too large their NC also become huge, we need to move the larger sub-directories to their own volumes to optimize the performance (If Number of Inode's are high then lookup would take significantly more time and create more Random I/O) and for the fact if disk/node crash it will take significant time to re-replicate due to high number of Inodes to be resynced

Here's how to move a sub-directory (test) to its own volume and not be part of root volume.

1)  Create a volume to hold new content and mount it any convenient location (test1).

[mapr@n2d logs]$ maprcli volume create -name test -path /test1

2) Now original directory is test and new one (test1) is mounted as volume.

[mapr@n2d logs]$ hadoop mfs -ls /

drwxr-xr-x Z   - mapr mapr          1 2014-10-24 12:59  268435456 /test
               p 2049.52.262576  n2d:5660 n1d:5660 n3d:5660
vrwxr-xr-x Z   - mapr mapr          0 2014-10-24 13:00  268435456 /test1

3) Move the data to volume.

[mapr@n2d logs]$ hadoop fs -mv /test/* /test1/
14/10/24 13:04:32 INFO fs.MapRFileSystem: Cannot rename across volumes, falling back on copy/delete semantics
 [mapr@n2d logs]$ hadoop fs -ls /test1 Found 1 items
-rwxr-xr-x   3 mapr mapr          0 2014-10-24 13:04 /test1/abizer

Note :- For huge volumes instead of using move please use distcp to take advantage of data to be copied in parallel .

hadoop distcp -p  <source> <destination>

4) Now delete original directory or move it to directory say "testold"

[mapr@n2d logs]$ hadoop fs -rmr /test
Deleted maprfs:/test

              or

[mapr@n2d logs]$ hadoop fs -mv /test  /testold

4) Unmount the test volume and mount it with original directory name and verify.

[mapr@n2d logs]$ maprcli volume unmount -name test
[mapr@n2d logs]$ maprcli volume mount -name test -path /test 
[mapr@n2d logs]$ hadoop fs -ls / Found 5 items
drwxr-xr-x   - mapr mapr          0 2014-07-11 13:45 /hbase
drwxr-xr-x   - mapr mapr          2 2014-10-15 15:10 /mirr_users
drwxr-xr-x   - mapr mapr          1 2014-10-24 13:04 /test
drwxr-xr-x   - mapr mapr          2 2014-10-15 15:10 /user
drwxr-xr-x   - mapr mapr          1 2014-07-11 13:45 /var
[mapr@n2d logs]$ hadoop fs -ls /test
Found 1 items
-rwxr-xr-x   3 mapr mapr          0 2014-10-24 13:04 /test/abizer

No comments:

Post a Comment