Skip to content

Instantly share code, notes, and snippets.

@smrmkt
Last active December 11, 2015 09:58
Show Gist options
  • Save smrmkt/4583106 to your computer and use it in GitHub Desktop.
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.
<?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