Last change
on this file since 28769 was 27005, checked in by jmt12, 11 years ago |
Similar to stop-impt.pl, this script uses kill to stop runaway Hadoop processes and can be run via rocks hosts run. This can happen, for instance, if tmpwatch wipes out the temporary files containing vital pids on the headnode. In related news Hadoop pid files now moved somewhere non-volatile on Medusa
|
-
Property svn:executable
set to
*
-
Property svn:mime-type
set to
application/x-perl
|
File size:
846 bytes
|
Line | |
---|
1 | #!/usr/bin/perl
|
---|
2 |
|
---|
3 | use strict;
|
---|
4 | use warnings;
|
---|
5 |
|
---|
6 | my $debug = 0;
|
---|
7 |
|
---|
8 | print "===== Stop Runaway Hadoop Nodes =====\n";
|
---|
9 |
|
---|
10 | print " * Searching running processes...\n";
|
---|
11 | open(FIN, 'ps ax -o pid,command |') or die($!);
|
---|
12 | my $line = '';
|
---|
13 | my $found_process = 0;
|
---|
14 | while (($line = <FIN>))
|
---|
15 | {
|
---|
16 | # Kill import processes
|
---|
17 | if ($line =~ /^\s*(\d+)\s+(.*)java -Dproc_(datanode|jobtracker|namenode|secondarynamenode|tasktracker)/)
|
---|
18 | {
|
---|
19 | my $pid = $1;
|
---|
20 | my $prefix = $2;
|
---|
21 | my $type = $3;
|
---|
22 | print " - Found " . $type . " process: [" . $pid . "]... ";
|
---|
23 | my $cmd = 'kill -KILL ' . $pid;
|
---|
24 | if ($debug)
|
---|
25 | {
|
---|
26 | print "[DEBUG] " . $cmd . "\n";
|
---|
27 | }
|
---|
28 | else
|
---|
29 | {
|
---|
30 | `$cmd`;
|
---|
31 | print "Process killed!\n";
|
---|
32 | }
|
---|
33 | $found_process = 1;
|
---|
34 | }
|
---|
35 | }
|
---|
36 | close(FIN);
|
---|
37 |
|
---|
38 | if (!$found_process)
|
---|
39 | {
|
---|
40 | print " * No running Hadoop processes found!\n";
|
---|
41 | }
|
---|
42 |
|
---|
43 | print "Complete!\n\n";
|
---|
44 |
|
---|
45 | exit;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.