Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AMBARI-26238: Add Ambari Java Home configuration for JDK 17 in Ambari… #3891

Merged

Conversation

JiaLiangC
Copy link
Contributor

… server

What changes were proposed in this pull request?

Background:

The Ambari Server uses the JAVA_HOME setting as its Java home during startup. Additionally, it propagates this JAVA_HOME to other components in the stack as their Java home. These components typically use JDK 8, which is set during the ambari-server setup process. The Ambari Server backend returns the JAVA_HOME in the Ambari-level parameters, which other components retrieve through Python scripts in the stack.

However, after upgrading the Ambari Server to JDK 17, the current setup process does not allow setting a separate JDK 17 JAVA_HOME specifically for the Ambari Server. To address this, a new ambari-java-home configuration is introduced to allow the Ambari Server to use JDK 17 as its Java home while retaining the existing JAVA_HOME for other components.


Changes Introduced:

  1. Added ambari-java-home Setting

    • A new configuration option, ambari-java-home, is introduced to set a dedicated JDK 17 path for the Ambari Server.
    • The backend will return this ambari-java-home value, enabling all tools in the stack that rely on Ambari's Java utilities to use the JDK 17 path.
  2. Code Adjustments for Services

    • Updated certain service scripts and tools that invoke Ambari's Java code to use the new ambari-java-home setting.

New Feature: --ambari-java-home Option

The ambari-server setup command now includes a new option, --ambari-java-home, to specify a dedicated Java home for the Ambari Server. This allows the Ambari Server to use JDK 17 while other components continue to use JDK 8.

Updated ambari-server setup Usage:

ambari-server setup [OPTIONS]

New Option:

  • --ambari-java-home <java_home>
    Specifies the Java home path for the Ambari Server.

Example Usage:

ambari-server setup -s \
                    -j /usr/lib/jvm/java-1.8.0-openjdk \
                    --ambari-java-home /usr/lib/jvm/java-17-openjdk

In this example:

  • -j specifies the default Java home (JDK 8) for other components.
  • --ambari-java-home specifies the dedicated Java home (JDK 17) for the Ambari Server.

Complete Example: Setting Up Ambari Server with Database and Java Configurations

Below is a complete example of configuring the Ambari Server, including database settings, default JAVA_HOME, and the new --ambari-java-home option:

ambari-server setup -s \
                    --jdbc-db mysql \
                    --jdbc-driver /path/to/mysql-connector-java.jar \
                    --database mysql \
                    --databasehost db.example.com \
                    --databaseport 3306 \
                    --databasename ambari \
                    --databaseusername ambari_user \
                    --databasepassword ambari_password \
                    -j /usr/lib/jvm/java-1.8.0-openjdk \
                    --ambari-java-home /usr/lib/jvm/java-17-openjdk

Explanation:

  1. Database Configuration

    • --jdbc-db mysql: Specifies the database type (e.g., mysql).
    • --jdbc-driver /path/to/mysql-connector-java.jar: Path to the JDBC driver for the database.
    • --database mysql: Specifies the database type.
    • --databasehost db.example.com: Hostname of the database server.
    • --databaseport 3306: Port number of the database server.
    • --databasename ambari: Name of the Ambari database.
    • --databaseusername ambari_user: Username for the database.
    • --databasepassword ambari_password: Password for the database.
  2. Java Configuration

    • -j /usr/lib/jvm/java-1.8.0-openjdk: Specifies the default JAVA_HOME for components (JDK 8).
    • --ambari-java-home /usr/lib/jvm/java-17-openjdk: Specifies the dedicated Java home for the Ambari Server (JDK 17).
  3. Automated Setup

    • -s: Skips interactive prompts for a fully automated setup.

Final Notes:

  • After running the setup command, restart the Ambari Server to apply the changes:

    ambari-server restart
  • Ensure that the JDBC driver path and database credentials are correct before running the command.

How was this patch tested?

manual test,unit test
(Please explain how this patch was tested. Ex: unit tests, manual tests)
(If this patch involves UI changes, please attach a screen-shot; otherwise, remove this)

Please review Ambari Contributing Guide before opening a pull request.

@JiaLiangC JiaLiangC merged commit f76c2a9 into apache:upgrade/jdk-spring-dependencies Nov 25, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants