Last active
April 1, 2020 08:49
-
-
Save lokkju/33f94126494faa8e27f98d588ff43bb3 to your computer and use it in GitHub Desktop.
Run a command on all nodes in a hadoop cluster
This file contains hidden or 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
# ssh -A hadoop@<masternode> | |
# SCRIPT=<yourscriptfile.sh> | |
declare nodes=`yarn node -list 2> /dev/null | grep internal | cut -d' ' -f1 | cut -d: -f1` | |
for node in $nodes | |
do | |
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null hadoop@$node 'bash -s' < $SCRIPT | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment