Using Custom Java Home Locations
Java, which Cloudera services require, may be installed at a custom location. In a such a case, Cloudera services may be unable to find this resource. If the JDK cannot be found, services such as MapReduce or HDFS may not start. If you installed the JDK to a custom location, you may need to modify the system configuration to ensure the JDK can be found.
For more information on installing the JDK, see "Java Development Kit Installation for CDH3" in the CDH3 Installation Guide or "Java Development Kit Installation for CDH4" in the CDH4 Installation Guide.
Cloudera provides two ways to ensure Cloudera services can find the JDK installation: modifying the Cloudera Agent Java home and modifying the service's Java home.
Modifying the Cloudera Agent Java Home
In many cases, modifying the CMF_AGENT_JAVA_HOME environment variable is an effective solution for updating the configuration to accommodate a custom JAVA_HOME. Modifying the CMF_AGENT_JAVA_HOME environment variable enables all services on the host to find the JDK.
- Open /etc/default/cloudera-scm-agent.
- Set the CMF_AGENT_JAVA_HOME environment variable to the Java home in your
environment. For example, you might modify the file to include the following
- Save and close the cloudera-scm-agent file.
- Restart the Cloudera Manager Agent using the following
sudo service cloudera-scm-agent restart
Modifying Service Java Home
You can modify service settings to use a custom JAVA_HOME. This is done as an alternative to modifying the CMF_AGENT_JAVA_HOME environment variable. Modifying service settings to use a custom JAVA_HOME applies to all hosts in the cluster, but you must repeat this process of updating JAVA_HOME for all services.
- Open the Cloudera Manager Admin Console. In the Home page, click the service that fails to start because the JDK location is misconfigured.
- Select .
- Add the custom Java home environment property, for example, JAVA_HOME=/opt/java/jdk6, to the service's environment safety valve.
- Click Save Changes.
- If your deployment includes Cloudera Management Services, add the custom JAVA_HOME value to /usr/share/cmf/bin/cmf-server.
- Restart the service.
To see how Cloudera Manager chooses a default JDK, review the contents of /usr/lib64/cmf/service/common/cloudera-config.sh.