Skip to content

Instantly share code, notes, and snippets.

@Zejnilovic
Created April 27, 2020 08:48
Show Gist options
  • Save Zejnilovic/6b58b300270237ce8cd439c858fabdb3 to your computer and use it in GitHub Desktop.
Save Zejnilovic/6b58b300270237ce8cd439c858fabdb3 to your computer and use it in GitHub Desktop.
A simple HDFS backup for local playing
#!/bin/bash
now=$(date +"%Y_%m_%d")
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