Ambari Server Upgrade

You can perform the following steps to upgrade the Ambari Server.

The following steps have to be performed on the installed Ambari Server node.

Stop Infra-Solr Service

Stop the Infra-solr Service from the Ambari UI by navigating to Ambari > Infra Solr > Actions > Stop.

Stop Ambari Server and Agents

Stop the Ambari server and agents by running the following command.

Bash
Copy

Warning Stop the Ambari Agents on all nodes in the cluster.

Configuration Backup

Take a backup of the Ambari-server configs.

Bash
Copy

Back up Ambari Database

Bash
Copy

Erase the Ambari Server

For RHEL:

Bash
Copy

For Ubuntu:

Bash
Copy

Add Ambari Repo on Cluster Nodes

Back up the Old Ambari Repository

For RHEL:

Bash
Copy

For Ubuntu:

Bash
Copy

Update the Repository Files

Retrieve the latest Ambari repository details from Ambari Repositories and add it to all the cluster nodes.

Update ambari.repo (RedHat) or ambari.list (Ubuntu).

For RHEL:

Bash
Copy
Bash
Copy

For Ubuntu:

Bash
Copy
Bash
Copy

List the New Packages

Verify the latest Ambari package for the version - 3.0.0.1-1.

For RHEL:

Bash
Copy

For Ubuntu 20:

Bash
Copy

Install the Updated Ambari Packages

For RHEL:

Bash
Copy

For Ubuntu:

Bash
Copy

Restore the Configuration Files

Copy ambari.properties and password.dat to /etc/ambari-server/conf/.

Once the installation is successful, make sure to set up the following versions.

Set up Java 17

Make sure to install and update the default Java version as 17 on all the cluster nodes.

For RHEL:

Bash
Copy

For Ubuntu:

Bash
Copy

Ensure not to remove the jdk8 packages at this state.

Bash
Copy

Set up Python 3.11

Bash
Copy

Make sure to install and update the default Python version as 3.11 on all the cluster nodes.

Bash
Copy

Update JSVC

Make sure to Instal the latest version of the bigtop-jsvc-1.2.4 on all the cluster nodes.

For RHEL:

Bash
Copy

For Ubuntu:

Bash
Copy

Restore Config Files

Restore the ambari.properties and password.dat files, which are backed up at this step: Configuration Backup on this page.

Restore the ambari.properties file

Bash
Copy

Please override the file by prompting 'y'.

Restore the password.dat file

Bash
Copy

Update the java.home and stack.java.home

In this case, set JAVA_HOME to /usr/lib/jvm/java-17-openjdk

File path - /etc/ambari-server/conf/ambari.properties | grep -i java.home

Bash
Copy

Update the Ambari Database with New Tables and Columns

MySQL

Bash
Copy

MariaDB

Bash
Copy
Bash
Copy

Oracle 19C

Bash
Copy

Postgres

Ambari Server Upgrade Fails on PostgreSQL Due to Missing ambari Schema

Summary:

When Ambari is backed by PostgreSQL and ambari-server upgrade is executed, the Java SchemaUpgradeHelper process fails immediately because it attempts to set the PostgreSQL search path to a schema named ambari, but that schema does not exist. All Ambari tables are instead located in the default public schema.

This issue is specific to PostgreSQL schema behavior.

Other database platforms do not encounter this problem because:

  • MySQL treats the database and schema as the same object, so no separate schema creation is required.
  • Oracle automatically creates a schema for each database user.
  • PostgreSQL requires schemas to be explicitly created. Unless a schema is manually created beforehand, tables are created in the default public schema.

Error:

The following error appears during ambari-server upgrade execution and in /var/log/ambari-server/ambari-server.log:

Bash
Copy

A secondary Python-level error may also appear:

Bash
Copy

This is not the root cause. The Java upgrade process terminated unexpectedly and returned empty output, causing the Python wrapper to fail while attempting to parse the response.

Root Cause

The Ambari ambari.properties contains the property:

Bash
Copy

This causes AbstractUpgradeCatalog.changePostgresSearchPath() to execute:

Bash
Copy

The upgrade fails because the ambari schema does not exist. The Ambari PostgreSQL DDL was run before the schema was created, so PostgreSQL placed all Ambari tables in the default public schema.

The database should have been initialized with:

Bash
Copy

Diagnosis

  1. Read the connection details from ambari.properties
Bash
Copy
  1. Check which schemas exist
Bash
Copy
  1. Check where the tables are located
Bash
Copy

Fix Procedure

Before making changes, take a full backup:

pg_dump -U ambari -h $DB_HOST ambari > /tmp/ambari_backup_ $(date +%Y%m%d).sql

  1. Set the DB connection variables

Set connection variables and verify connectivity:

Bash
Copy
  1. Create the ambari schema and move all objects

Create the schema, move tables and sequences, and set the search path:

Bash
Copy
  1. Verify

Verify all tables are now in the ambari schema:

Bash
Copy
  1. Retry the upgrade
Bash
Copy

Why does this only affect PostgreSQL?

DatabaseSchema behaviorAmbari impact
MySQL / MariaDBDatabase and schema are the same conceptNo issue
Oracle 19cThe schema is automatically created per userNo issue
PostgreSQLThe schema must be created manuallyUpgrade fails if the schema is missing

Prevention

For new Ambari PostgreSQL deployments, create the schema before running the Ambari DDL:

Bash
Copy

Then run the Ambari DDL:

Bash
Copy

Correct Setup Checklist:

Before running Ambari PostgreSQL DDL, confirm that:

  • Database ambari exists.
  • User ambari exists.
  • password.dat contains the correct password.
  • Schema ambari exists.
  • Schema ambari is owned by user ambari.
  • ALTER ROLE ambari SET search_path TO ambari, public has been run.
  • Ambari tables are created in the ambari schema, not public.

Upgrade the Ambari Server Database Schema

Bash
Copy

Upon running the command, the response will be as shown in the screenshot.

Make sure to take the database backup as mentioned earlier and enter 'y' here.

Start the Ambari Server

Once started, you are able to access the Ambari UI using the same url as it was earlier.

Bash
Copy

Access the Ambari UI

Use your browser to access the Ambari UI.

Check the Upgraded Version

To verify the upgraded Ambari version, navigate to Admin → About in the top-right corner of the Ambari UI.

All the services also must be working normally without any downtime.

Known Issues

Pip dependency missing

Error:

Bash
Copy

Workaround:

Bash
Copy

If still hitting the distro module not found error, follow the below steps:

Step 1:

  1. Download the get-pip.py script:
Bash
Copy
  1. Install pip for Python 3.11:
Bash
Copy

Step 2: Install the distro module using pip3.11

Once `pip` is installed for Python 3.11, you can now use it to install the missing `distro` module:

Bash
Copy

Step 3: Verify the installation.

After installing the distro module, verify that it’s correctly installed:

Bash
Copy

The ambari-server upgrade -v upgrade is successfully done.

Mpacks uninstallation not done

Bash
Copy

Workaround: Uninstall all the ambari-mpacks.

Bash
Copy
VariableType to search · ESC to discard
GlossaryType to search · ESC to discard
InsertType to search · ESC to discard
No matches
  Last updated