Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- hdfs dfs -mkdir /tmp/mydirectory
- -- put some files into your directory
- hdfs dfs –put important-file.txt /tmp/mydirectory
- -- Allowing smaphot for your directory
- hdfs dfsadmin -allowSnapshot /tmp/mydirectory
- -- create a snapshot to your directory
- hdfs dfs -createSnapshot /tmp/mydirectory snapshot_one
- -- Testing removing directory( snapshot directory cannot be removed)
- hdfs dfs -rm -r -skipTrash /tmp/mydirectory
- -- removing files from snapshot directory (yes, fles in dnapshot directory can be removed!!)
- hdfs dfs -rm -r /tmp/mydirectory/somefile.ext
- Recover the file from the snapshot
- --list all the snapshot directory
- hdfs lsSnapshottableDir
- --First, find the file that you want to recover from in the snapshot subdirectory:
- hdfs dfs –lsr –R /tmp/mydirectory/.snapshot
- -- reading deleted file from snapshot
- hdfs dfs -cat /tmp/mydirectory/.snapshot/snapshot_one/somefile.ext
- --copy the file from snapshot to your directory (using cp command)
- hdfs dfs -cp /tmp/mydirectory/.snapshot/snapshot_one/isomefile.ext /tmp/mydirectory
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement