Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
HADOOP: Fix HDFS under replicated blocks
#!/usr/bin/bash
HDFSUSER=hdfs
URFILES=/tmp/under_replicated_files
sudo -u $HDFSUSER hdfs fsck / | grep 'Under replicated' | awk -F':' '{print $1}' >> $URFILES
sudo -u $HDFSUSER for hdfsfile in `cat $URFILES`; do echo "Fixing $hdfsfile :" ; hdfs dfs -setrep 3 $hdfsfile; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment