Created
May 24, 2019 10:05
-
-
Save Zejnilovic/1cb7782236578860b2f88bf4d835dce5 to your computer and use it in GitHub Desktop.
Backup HDFS to local FS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
now=$(date +"%m_%d_%Y") | |
file=hadoop_backup_$now | |
cd ~ | |
mkdir -p $file | |
hdfs dfs -ls / | grep "^[d-]"| awk '{print $8}' | while read line; do hdfs dfs -get $line $file ; done | |
zip -r $file.zip $file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment