JiaLiangC opened a new pull request, #3891:
URL: https://github.com/apache/ambari/pull/3891

   … 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:
   ```bash
   ambari-server setup [OPTIONS]
   ```
   
   #### New Option:
   - `--ambari-java-home <java_home>`  
      Specifies the Java home path for the Ambari Server.
   
   #### Example Usage:
   ```bash
   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:
   
   ```bash
   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:
     ```bash
     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](https://cwiki.apache.org/confluence/display/AMBARI/How+to+Contribute) 
before opening a pull request.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to