Skip to content

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
JiaLiangC added a commit that referenced this pull request Dec 27, 2024
#3891)

* AMBARI-26238: Add Ambari Java Home configuration for JDK 17 in Ambari server
JiaLiangC added a commit that referenced this pull request Feb 6, 2025
* AMBARI-26232 There will be failure when executing shell.py and wrong order of imports for WidgetResourceProvider.java (#3872)

* There will be failure when executing shell.py
* Wrong order of imports for WidgetResourceProvider.java
* Fix issue of test failure

* AMBARI-26234: ClusterNotFoundException in stage Confirm Hosts during deploying a cluster #3875

* AMBARI-26184: Resolve snakeyaml 1.12 CVE #3869

* AMBARI-26235: Unable to check firewalld status when setup ambari #3878

* AMBARI-26195: Ambari database page not wokring after JQ upgrade #3885

* AMBARI-26239: Fix OozieUtils (#3894)

* AMBARI-26239: Fix OozieUtils

* AMBARI-26205: Dropdown menu flex layout overflow #3895

* AMBARI-26236: The database password character type requirement is too few (#3883)

* The database password character type requirement is too few
* Add more special characters, and add UT for this case
* Update test case

* AMBARI-26240: Fix alter dispatcher (#3896)

* AMBARI-26241: _threadlocal has no uid because it is always None #3898

* AMBARI-26243: refactor: convert .format() to f-strings #3899

* AMBARI-26244: convert .format() to f-strings for ambari-server #3901

* AMBARI-26245: refactor(ambari-agent): convert .format() to f-strings (#3902)

* AMBARI-26249: Timeline Service v2 failed to start because of unable to create leveldb state store directory #3905

* AMBARI-26247: convert .format() to f-strings for ambari-contrib #3903

* Update the KEYS File

* AMBARI-26253: Can't download all client configs (#3906)

* AMBARI-26257: Create new Configuration Group now worked #3907

* AMBARI-26248: Timeline Service Reader failed to start if hbase is not installed #3904

* AMBARI-26147: Add Ruff integration to ambari  (#3908)

* add ruff check files
* add formatted code

* AMBARI-26251: tooltip display issue #3911

* AMBARI-26207: Metrics sortable not work #3912

* AMBARI-26255: fix can't add capacity-scheduler views (#3913)

* AMBARI-26270: Add quicklink of hiveserver2 web ui #3918

* AMBARI-26142: JDK17 support for Ambari Co-authored-by: Mohammad Arshad <[email protected]> (#3851)

* AMBARI-26204: Migrate RecommendationResourceProviderTest from EasyMoc… (#3860)

* AMBARI-26204: Migrate RecommendationResourceProviderTest from EasyMock to Mockito

* AMBARI-26203: Fix annotation processing issue in ConfigurationTest after JDK 17 upgrade (#3859)

* AMBARI-26203: Fix testAllPropertiesHaveMarkdownDescriptions failed

* AMBARI-26212: Fix checkstyle error (#3862)

* Ambari-26211: Fix TaskActionScheduler test failed (#3861)

* AMBARI-26211: Fix TaskActionScheduler test failed

* AMBARI-26215: Fix BlueprintConfigurationProcessorTest and others (#3863)

* AMBARI-26215: Fix BlueprintConfigurationProcessorTest and others

* AMBARI-26220: Fix ConfigureClusterTaskTest Unexpected method calls: ClusterConfigurationRequest.getRequiredHostGroups() error (#3864)

fix AsyncCallableServiceTest Unexpected method calls: Callable.call() error

* AMBARI-26221: Fix StackAdvisorCommandTest error,remove unnecessary code. (#3865)

* AMBARI-26222: Fix ClientConfigResourceProviderTest & PreUpgradeCheckResourceProviderTest& ExecutionSchedulerTest& AmbariProxiedUserDetailsServiceTest

* AMBARI-26233: Fix ambari-env.sh after jdk upgrade (#3873)

* fix ambari agent env after jdk upgrade

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

* AMBARI-26238: Add Ambari Java Home configuration for JDK 17 in Ambari server

* AMBARI-26268: Remove default value for ambari-java-home in ambari-server.py to fix setup handling #3915

Co-authored-by: tongxiaojun <[email protected]>

* AMBARI-26269: Fix regex pattern flag position in ambari_jinja2 filters #3917

* AMBARI-26269: Fix regex pattern flag position in ambari_jinja2 filters
---------

Co-authored-by: tongxiaojun <[email protected]>

* AMBARI-26249: Addendum, adjusting the location of creating directory code (#3920)

* AMBARI-26271: Invalid parameter was provided when using shell.call in HostInfo.py #3919

* AMBARI-26273: Add Oceanbase Support to Ambari MySQL DDL #3921

Co-authored-by: tongxiaojun <[email protected]>

* AMBARI-26275: NoClassesFoundToAnalyzeException when compiling ambari with jdk17 #3924

* AMBARI-25848 : Need to update org.codehaus.jackson:jackson-mapper-asl dependency (#3922)

Issue: Need to update org.codehaus.jackson:jackson-mapper-asl dependency.

Cause: the library has been moved to com.fasterxml.jackson.core » jackson-databind,
hence to keep up with the newer versions need to update the library dependency.

Changes made: to update the jackson-mapper-asl dependency to jackson-databind and the required library version upgrades

Co-authored-by: Vishal Suvagia <[email protected]>

* AMBARI-26276: fix hdfs web service check (#3925)

* AMBARI-26277:fix kerberos encryption error (#3926)

* AMBARI-26279: ambari-agent prints logs that netstat command not found #3928

* AMBARI-26286: refactor(ambari-ruff): convert .format() to f-strings #3927

AMBARI-26286: refactor(ambari-ruff): convert .format() to f-strings

* AMBARI-26055: Add alluxio support (#3934)

* add alluxio service

Co-authored-by: jialiang <[email protected]>

* fix license

---------

Co-authored-by: jialiang <[email protected]>

* AMBARI-26185: Upgrade commons-collections to resolve CVEs (#3936)

---------

Co-authored-by: Peng Lu <[email protected]>
Co-authored-by: Sandeep  Kumar <[email protected]>
Co-authored-by: zrain <[email protected]>
Co-authored-by: coldless177 <[email protected]>
Co-authored-by: jialiang <[email protected]>
Co-authored-by: yaruyng <[email protected]>
Co-authored-by: tongxiaojun <[email protected]>
Co-authored-by: tongxiaojun <[email protected]>
Co-authored-by: Vishal Suvagia <[email protected]>
Co-authored-by: Vishal Suvagia <[email protected]>
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