Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. hdfs dfs -mkdir /tmp/mydirectory
  2.  
  3. -- put some files into your directory
  4. hdfs dfs –put important-file.txt /tmp/mydirectory
  5.  
  6. -- Allowing smaphot for your directory
  7. hdfs dfsadmin -allowSnapshot /tmp/mydirectory
  8.  
  9. -- create a snapshot to your directory
  10. hdfs dfs -createSnapshot /tmp/mydirectory snapshot_one
  11.  
  12. -- Testing removing directory( snapshot directory cannot be removed)
  13. hdfs dfs -rm -r -skipTrash /tmp/mydirectory
  14.  
  15. -- removing files from snapshot directory (yes, fles in dnapshot directory can be removed!!)
  16. hdfs dfs -rm -r /tmp/mydirectory/somefile.ext
  17.  
  18. Recover the file from the snapshot
  19. --list all the snapshot directory
  20. hdfs lsSnapshottableDir
  21.  
  22. --First, find the file that you want to recover from in the snapshot subdirectory:
  23. hdfs dfs –lsr –R /tmp/mydirectory/.snapshot
  24.  
  25. -- reading deleted file from snapshot
  26. hdfs dfs -cat /tmp/mydirectory/.snapshot/snapshot_one/somefile.ext
  27.  
  28. --copy the file from snapshot to your directory (using cp command)
  29. hdfs dfs -cp /tmp/mydirectory/.snapshot/snapshot_one/isomefile.ext /tmp/mydirectory
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement