Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here. Want to know more about what has changed? Check out the Community News blog.

command "yarn application" doesn't work. Getting "No HADOOP_CONF_DIR set" error.

SOLVED Go to solution

command "yarn application" doesn't work. Getting "No HADOOP_CONF_DIR set" error.

New Contributor

When I try to terminate an yarn application in CDH 5.8.x, I got the following error:

 

```

$ yarn application
No HADOOP_CONF_DIR set.
Please specify it either in yarn-env.sh or in the environment.

```

 

I've searched through all directory and found no yarn-env.sh, this error message is quite misleading.

 

Does some one know how to fix it?

1 ACCEPTED SOLUTION

Accepted Solutions

Re: command "yarn application" doesn't work. Getting "No HADOOP_CONF_DIR set" er

Master Guru
You do not need to set these env-vars manually. They should be set automatically for you in CDH.

The env-var, if you do choose to set it manually for some reason, must point to a singular directory of configs vs. multiple in a classpath style as it appears in your output.

Can you retry with an unset HADOOP_CONF_DIR since its handled automatically and your value's causing it to not use the automatic location? Does /etc/hadoop/conf/ exist now with usable files under it?
4 REPLIES 4

Re: command "yarn application" doesn't work. Getting "No HADOOP_CONF_DIR set" er

Master Guru
Please add more notes on how you've installed CDH and how you're managing it.

If you use Cloudera Manager, then does the host you use to run this command have a YARN Gateway role added and deployed on it?

Specifically, do you have a /etc/hadoop/conf/ directory with all required config files? If not this error would pop up.

Re: command "yarn application" doesn't work. Getting "No HADOOP_CONF_DIR set" er

New Contributor
Thanks a lot! I've add YARN Gateway and yarn application is working. I must have forgot to override YARN gateway in installation.

Also, should it be a recommended setting to add YARN gateway to all nodes?

Re: command "yarn application" doesn't work. Getting "No HADOOP_CONF_DIR set" er

New Contributor

Still has the same problem after a service reboot!

 

Looks like the gateway wasn't written through, strangely, my echo doesn't show any missing environment variable:

 

```

ubuntu@ip-172-31-23-254:~$ yarn application
No HADOOP_CONF_DIR set.
Please specify it either in yarn-env.sh or in the environment.
ubuntu@ip-172-31-23-254:~$ echo $HADOOP_CONF_DIR
/etc/spark/conf/yarn-conf:/etc/hive/conf

```

 

it looks like yarn get its variable elsewhere

Re: command "yarn application" doesn't work. Getting "No HADOOP_CONF_DIR set" er

Master Guru
You do not need to set these env-vars manually. They should be set automatically for you in CDH.

The env-var, if you do choose to set it manually for some reason, must point to a singular directory of configs vs. multiple in a classpath style as it appears in your output.

Can you retry with an unset HADOOP_CONF_DIR since its handled automatically and your value's causing it to not use the automatic location? Does /etc/hadoop/conf/ exist now with usable files under it?