Step 2: Install Java Development Kit
For the JDK, you can either install the Oracle JDK version provided by Cloudera using Cloudera Manager, a different Oracle JDK directly from Oracle, or OpenJDK. Most Linux distributions supported by Cloudera include OpenJDK, but manual installation instructions are provided below if needed.
OpenJDK is supported with Cloudera Enterprise 6.1.0 and higher, and Cloudera Enterprise 5.16.0 and higher.
Requirements
- The JDK must be 64-bit. Do not use a 32-bit JDK.
- The installed JDK must be a supported version as documented in Java Requirements.
- The same version of the JDK must be installed on each cluster host.
- The JDK must be installed at /usr/java/jdk-version.
Installing Oracle JDK Using Cloudera Manager
After completing Step 1: Configure a Repository for Cloudera Manager, you can install the Oracle JDK on the Cloudera Manager Server host using your package manager as follows:
- RHEL Compatible
sudo yum install oracle-j2sdk1.8
- SLES
sudo zypper install oracle-j2sdk1.8
- Ubuntu
sudo apt-get install oracle-j2sdk1.8
You can use Cloudera Manager to install the JDK on the remaining cluster hosts in an upcoming step. Continue to Step 3: Install Cloudera Manager Server.
Manually Installing Oracle JDK
The Oracle JDK installer is available both as an RPM-based installer for RPM-based systems, and as a .tar.gz file. These instructions are for the .tar.gz file.
- Download the .tar.gz file for one of the 64-bit supported versions of the Oracle JDK from Java SE 8 Downloads. (This link is correct at the time of writing, but can change.)
- Extract the JDK to /usr/java/jdk-version. For example:
tar xvfz /path/to/jdk-8u<update_version>-linux-x64.tar.gz -C /usr/java/
- Repeat this procedure on all cluster hosts. After you have finished, continue to Step 3: Install Cloudera Manager Server.
Manually Installing OpenJDK
Before installing Cloudera Manager and CDH, perform the steps in this section to install OpenJDK on all hosts in your cluster(s).
- The package names used when installing the OpenJDK 11 and OpenJDK 8 are different and are noted in the steps below.
- The path for the default truststore has changed from (OpenJDK 8) jre/lib/security/cacerts to (OpenJDK 11) lib/security/cacerts
- See the following blog post for general information about migrating to Java 11: All You Need to Know For Migrating To Java 11.
See Supported JDKs for information on which JDK versions are supported for Cloudera Enterprise releases.
You must install a supported version of OpenJDK. If your deployment uses a version of OpenJDK lower than 1.8.0_181, see TLS Protocol Error with OpenJDK.
- Log in to each host and run the command for the version of the JDK you want to install:
- RHEL
- OpenJDK 8
su -c yum install java-1.8.0-openjdk-devel
- Ubuntu
- OpenJDK 8
sudo apt-get install openjdk-8-jdk
- SLES
- OpenJDK 8
sudo zypper install java-1_8_0-openjdk-devel
- Tune the JDK (OpenJDK 11 only.)
OpenJDK 11 uses new defaults for garbage collection and other Java options specified when launching Java processes. Due to these changes you may need to tune the garbage collection by adjusting the Java options used to run cluster services, which are configured separately for each service using the service's configuration parameters. To locate the correct parameter, log in to the Cloudera Manager Admin Console, go to the cluster and service you want to configure and search for "Java Configuration Options".
When using OpenJDK 11, Cloudera Manager and most CDH services use G1GC as the default method of garbage collection. Java 8 used "ConcurrentMarkSweep" (CMS) for garbage collection. When using G1GC, the pauses for garbage collection are shorter, so components will usually be more responsive, but they are more sensitive to JVMs with overcommitted memory usage. See Tuning JVM Garbage Collection.