AMBARI-26238: Add Ambari Java Home configuration for JDK 17 in Ambari… #3891
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
… 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 thisJAVA_HOME
to other components in the stack as their Java home. These components typically use JDK 8, which is set during theambari-server setup
process. The Ambari Server backend returns theJAVA_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 17JAVA_HOME
specifically for the Ambari Server. To address this, a newambari-java-home
configuration is introduced to allow the Ambari Server to use JDK 17 as its Java home while retaining the existingJAVA_HOME
for other components.Changes Introduced:
Added
ambari-java-home
Settingambari-java-home
, is introduced to set a dedicated JDK 17 path for the Ambari Server.ambari-java-home
value, enabling all tools in the stack that rely on Ambari's Java utilities to use the JDK 17 path.Code Adjustments for Services
ambari-java-home
setting.New Feature:
--ambari-java-home
OptionThe
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:New Option:
--ambari-java-home <java_home>
Specifies the Java home path for the Ambari Server.
Example Usage:
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:Explanation:
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.Java Configuration
-j /usr/lib/jvm/java-1.8.0-openjdk
: Specifies the defaultJAVA_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).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:
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.