How to kill a mapred job started by hive?

2shou picture 2shou · Feb 12, 2015 · Viewed 28k times · Source

I'm working by CDH 5.1 now. It starts normal Hadoop job by YARN but hive still works with mapred. Sometimes a big query will hang for a long time and I want to kill it.

I can find this big job by JobTracker web console while it didn't provide a button to kill it.

Another way is killing by command line. However, I couldn't find any job running by command line.

I have tried 2 commands:

  • yarn application -list
  • mapred job -list

How to kill big query like this?

Answer

Harman picture Harman · Feb 12, 2015

You can get the Job ID from Hive CLI when you run a job or from the Web UI. You can also list the job IDs using the application ID from resource manager. Ideally, you should get everything from

mapred job -list

or

hadoop job -list

Using the Job ID you can kill it by using the below command.

hadoop job -kill <job_id>

Another alternative would be to kill the application using

yarn application -kill <application_id>