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. If Java is installed at a custom location, update system settings so the custom location is used, and then restart Cloudera Manager Agent on the host where the failing service is assigned. Note that you must know the custom java location that was established during the JDK installation process.

Cloudera provides two ways to ensure Cloudera services can find your JDK installation.

Modifying CMF_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. To modify the CMF_AGENT_JAVA_HOME environment variable

  1. Open /etc/default/cloudera-scm-agent.
  2. 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 line:
    export CMF_AGENT_JAVA_HOME=/usr/custom_java
  3. Save and close the cloudera-scm-agent file.
  4. Restart the Cloudera Manager Agent using the following command:
    sudo service cloudera-scm-agent restart

Modifying Service Settings

You can modify service settings to use your 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 nodes in the cluster, but you must repeat this process of updating JAVA_HOME for all services. To modify service settings to use your custom JAVA_HOME

  1. Open the Cloudera Manager Admin Console, click any service that fails to start because the JDK location is misconfigured, and click Configuration.
  2. Under Service-Wide, click Advanced.
  3. Click the Value cell for the Service Environment Safety Valve and add your custom java home to the property here. For example, you might enter the value JAVA_HOME=/opt/java/jdk6.
  4. Click Save Changes.
  5. If your deployment includes Cloudera Management services, add your custom JAVA_HOME value to /usr/share/cmf/bin/cmf-server.
  6. In the Cloudera Manager Admin Console, for the service you are configuring, click Actions and click Restart.
  7. Repeat this process for all services that need the updated JAVA_HOME value.

To see how Cloudera Manager chooses a default JDK, review the contents of /usr/lib64/cmf/service/common/cloudera-config.sh.