Skip to content

Instantly share code, notes, and snippets.

@peterlee0127
Created October 6, 2016 15:14
Show Gist options
  • Save peterlee0127/413392ee5ba229676ae2e0f4c7ea6701 to your computer and use it in GitHub Desktop.
Save peterlee0127/413392ee5ba229676ae2e0f4c7ea6701 to your computer and use it in GitHub Desktop.
#! /bin/sh
if [ "$1" = "namenode" ]
then
start-dfs.sh
elif [ "$1" = "datanode" ]
then
netstat -na | grep 50010 -q ;
if [ $? -eq 1 ]
then
echo "next"
wget http://hdfs/hadoop.tar.gz
tar xvf hadoop*
cd hadoop*
./bin/hdfs datanode
else
exit
fi
elif [ "$1" = "clearHDFS" ]
then
sudo rm -rf /app/hadoop/tmp
sudo mkdir -p /app/hadoop/tmp
sudo chown node /app/hadoop/tmp
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment