Created
February 25, 2015 06:47
-
-
Save jihao/242b6695079d51ac2581 to your computer and use it in GitHub Desktop.
sync file to hadoop slaves nodes using scp
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 | |
slaves=(`cat $HADOOP_PREFIX/etc/hadoop/slaves`) | |
for slave in ${slaves[@]} | |
do | |
echo "kill HRegionServer in $slave ..." | |
`ssh $USER@$slave "jps | grep HRegionServer | awk '{print \$1}' | xargs kill -9"` | |
done |
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 | |
slaves=(`cat $HADOOP_PREFIX/etc/hadoop/slaves`) | |
for file in "$@" | |
do | |
fullpath=`readlink -f "$file"` | |
for slave in ${slaves[@]} | |
do | |
echo "sync $fullpath with $slave ..." | |
`scp $fullpath $USER@$slave:$fullpath` | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment