Last active
December 11, 2015 09:58
-
-
Save smrmkt/4583106 to your computer and use it in GitHub Desktop.
Kill hadoop DataNode/TaskTracker process using ssh. You can kill all hadoop nodes' zombie processes with this script.
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
<?php | |
$hosts = array('slave_host01', 'slave_host02', 'slave_host03'); | |
foreach ($hosts as $host) { | |
exec("ssh $host /usr/java/default/bin/jps | /bin/grep 'DataNode\|TaskTracker' | /bin/sed 's/\([0-9]\) .*/\1/'", $pids); | |
foreach ($pids as $pid) { | |
exec("ssh $host kill $pid); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment