rekha gupta
rekha gupta

Reputation: 27

how to Kill hadoop task started using hadoop jar command?

I'm pretty new to using Hadoop.

I used hadoop jar command like the one below -

hadoop jar $jarpath/BDAnalytics.jar \
   bigdat.twitter.crawler.CrawlTwitter \
   $crwlInputFile  > $logsFldr/crawler_$1.log 2>&1 &

But I need to kill this process, and not able to understand how. There are a lot of links to kill hadoop jobs but since this is not a job but a task/java process.

I will high appreciate if you could let me know the command to kill such a process. Thanks in advance! -RG

Upvotes: 0

Views: 477

Answers (1)

zsxwing
zsxwing

Reputation: 20836

You can use the shell command kill. For example, use ps -ef | grep bigdat.twitter.crawler.CrawlTwitter to find the pid, and use kill -9 pid_of_the_process to kill it. You can write a script containing the following command to do the kill action:

#!/bin/bash    
kill -9 $(ps -ef | grep bigdat.twitter.crawler.CrawlTwitter | sed "s/\s\+/\t/g" | cut -f2)

Upvotes: 1

Related Questions