Skip to content

Instantly share code, notes, and snippets.

@gbraccialli
Created April 7, 2016 18:06
Show Gist options
  • Save gbraccialli/352da50e0773f8db25728b79c5e3bb32 to your computer and use it in GitHub Desktop.
Save gbraccialli/352da50e0773f8db25728b79c5e3bb32 to your computer and use it in GitHub Desktop.
hadoop fs -rm -r -f /tmp/test_snapshot
hadoop fs -mkdir /tmp/test_snapshot
hadoop fs -put x.txt /tmp/test_snapshot
hadoop fsck /tmp/test_snapshot/ -files -blocks -locations -includeSnapshots
(execute as hdfs user)
hdfs dfsadmin -allowSnapshot /tmp/test_snapshot/
hadoop fs -createSnapshot /tmp/test_snapshot/ snapshot1
hadoop fsck /tmp/test_snapshot/ -files -blocks -locations -includeSnapshots
hadoop fs -rm /tmp/test_snapshot/x.txt
hadoop fsck /tmp/test_snapshot/ -files -blocks -locations -includeSnapshots
hadoop fs -put x.txt /tmp/test_snapshot
hadoop fsck /tmp/test_snapshot/ -files -blocks -locations -includeSnapshots
hadoop fs -rm /tmp/test_snapshot/x.txt
hadoop fs -put x.txt /tmp/test_snapshot/y.txt
hadoop fs -put x.txt /tmp/test_snapshot/z.txt
hadoop fsck /tmp/test_snapshot/ -files -blocks -locations -includeSnapshots
hadoop fs -createSnapshot /tmp/test_snapshot/ snapshot2
hadoop fsck /tmp/test_snapshot/ -files -blocks -locations -includeSnapshots
hadoop fs -cp /tmp/test_snapshot/.snapshot/snapshot1/x.txt /tmp/test_snapshot
hadoop fsck /tmp/test_snapshot/ -files -blocks -locations -includeSnapshots
hadoop fs -deleteSnapshot /tmp/test_snapshot/ snapshot1
hadoop fsck /tmp/test_snapshot/ -files -blocks -locations -includeSnapshots
hadoop fs -rm /tmp/test_snapshot/x.txt
hadoop fsck /tmp/test_snapshot/ -files -blocks -locations -includeSnapshots
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment