Saturday 2 January 2016

Hadoop: How to get Snapshots Difference Report

You can get the difference between two snapshots using “hdfs snapshotDiff” command.

Usage
hdfs snapshotDiff <path> <fromSnapshot> <toSnapshot>

path: The path of the snapshottable directory.
fromSnapshot: The name of the starting snapshot.
toSnapshot: The name of the ending snapshot.

$ hdfs dfsadmin -allowSnapshot /user/harikrishna_gurram
Allowing snaphot on /user/harikrishna_gurram succeeded
$ 
$ hdfs dfs -createSnapshot /user/harikrishna_gurram snapshot1
Created snapshot /user/harikrishna_gurram/.snapshot/snapshot1
$ 
$ hadoop fs -touchz /user/harikrishna_gurram/file3.txt /user/harikrishna_gurram/file4.txt 
$
$ hdfs dfs -createSnapshot /user/harikrishna_gurram snapshot2
Created snapshot /user/harikrishna_gurram/.snapshot/snapshot2
$ 
$ hdfs snapshotDiff /user/harikrishna_gurram snapshot1 snapshot2
Difference between snapshot snapshot1 and snapshot snapshot2 under directory /user/harikrishna_gurram:
M .
+ ./file3.txt
+ ./file4.txt

Result
Description
+
The file/directory has been created.
-
The file/directory has been deleted.
M
The file/directory has been modified.
R
The file/directory has been renamed.




Previous                                                 Next                                                 Home

No comments:

Post a Comment