Skip to content

Instantly share code, notes, and snippets.

@Zejnilovic
Created May 24, 2019 10:05
Show Gist options
  • Save Zejnilovic/1cb7782236578860b2f88bf4d835dce5 to your computer and use it in GitHub Desktop.
Save Zejnilovic/1cb7782236578860b2f88bf4d835dce5 to your computer and use it in GitHub Desktop.
Backup HDFS to local FS
#!/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