Upgrade Ambari Server

Follow the below steps to upgrade the Ambari version.

Stop Infra-solr Service

Stop the Infra-solr Service from Ambari-UI.


Stop Ambari Server and Agents

Stop Ambari Server

Info

Take the backup of ambari-server configs.

/etc/ambari-server/conf/

ambari-server stop

Stop Agents

Stop Ambari-agent on every cluster nodes.

ambari-agent stop

Back up Ambari Database

Take the Ambari-server backend database backup from the server host.

DB Backup Commands

mkdir /tmp/ambari-server_db_bckp mysqldump --databases ambari > /tmp/ambari-server_db_bckp/ambari_mysql_bckp.sql

The upgraded version Ambari-2.7.8.2-3 supports only Python 3.11. Ensure that Python 3.11 is installed and configured on all the cluster nodes before proceeding with the upgrade.

Add Ambari Repo on Cluster Nodes

Back up the Old Ambari Repository

Run the following command:

mv /etc/yum.repos.d/ambari.repo /tmp/

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

List the existing Ambari packages

On RHEL:

rpm -qa | grep ambari

On Ubuntu:

apt list ambari-*

Example Output (if the current Ambari version is 2.7.9.2-1):

ambari-infra-solr-2.7.9.2-1.noarch ambari-agent-2.7.9.2-1.x86_64 ambari-server-2.7.9.2-1.x86_64 ambari-infra-solr-client-2.7.9.2-1.noarch

Remove existing Ambari rpm’s

From the Ambari Server node, remove the installed packages before upgrading:

On RHEL:

yum remove ambari-server

On Ubuntu:

apt remove ambari-server

Note

  • Adjust the package names based on the installed versions on each node.

  • You can verify the installed packages before removing them using:

On RHEL:

rpm -qa | grep ambari

On Ubuntu:

apt list ambari-*

Make sure the Amabri packages are not installed.

Install Ambari packages

Info

If you are upgrading from any Python 2 based ODP version, make sure to perform the below additional steps to install Python 3.11 and its dependencies on all the hosts before proceeding with the next step.

For Ubuntu 20/22:

apt install software-properties-common add-apt-repository ppa:deadsnakes/ppa apt update apt-get install python3.11 curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py /usr/bin/python3.11 get-pip.py pip3.11 install distro lxml

For RHEL 8:

yum install python3.11 python3.11-pip pip3.11 install distro lxml

Install the latest Ambari-server only on ambari-server node.

Server Node

On RHEL:

yum clean all yum install ambari-server -y

On Ubuntu:

apt clean apt update apt install ambari-server -y

Ambari Server Configuration Files Restore

Restore the configuration files backed up at step4 (Backup taken in step 4).

Restore ambari.properties File

cp conf_12_02_25_16_52.save/ambari.properties conf/

When prompted, enter 'y' to confirm.

cp: overwrite 'conf/ambari.properties'? y

Restore passwd.dat File

cp /etc/ambari-server/conf_12_02_25_16_52.save/password.dat /etc/ambari-server/conf/password.dat

Ambari Server Schema Upgrade

Before upgrading, ensure a database backup has been taken (as mentioned in Step 6).

Run the Ambari Server upgrade command:

ambari-server upgrade -v

If you encounter the following error:

python version after sym links /usr/bin/python3.11 Using python /usr/bin/python3.11 Upgrading ambari-server Traceback (most recent call last): File "/usr/sbin/ambari-server.py", line 28, in <module> from ambari_commons.exceptions import FatalException, NonFatalException File "/usr/lib/ambari-server/lib/ambari_commons/__init__.py", line 21, in <module> from ambari_commons.os_check import OSCheck, OSConst File "/usr/lib/ambari-server/lib/ambari_commons/os_check.py", line 25, in <module> import distro ModuleNotFoundError: No module named 'distro'

Set up the Distro Module

Install the required dependencies on the ambari-server and ambari-agent nodes.

On RHEL:

yum install python3.11-pip -y
pip3.11 install distro lxml

On Ubuntu:

apt-get update apt-get install python3-pip pip3 install distro

Retry the Upgrade again

ambari-server upgrade -v

Response when prompted:

Ambari Server configured for MySQL. Confirm you have made a backup of the Ambari Server database [y/n] (n)? y Enter 'y' to confirm.

After the successful completion, you must see the following message.

Ambari Server 'upgrade' completed successfully.

Start Ambari-server

ambari-server start

Once started, verify that the Ambari UI is accessible using the same URL as before.

Verify Ambari Version

Verify the upgraded Ambari version in admin->about on top right corner in Ambari UI.


The Ambari version is upgraded successfully.

Upgrade Known Issues

During the migration, the existing GROUPS table in the Ambari database might cause conflicts due to its name. As a result, the Ambari UI might fail to start and throw the following error when attempting to log in.

Internal Exception: java.sql.SQLSyntaxErrorException: Table 'ambari.groups_info' doesn't exist Error Code: 1146 Call: SELECT group_id, group_name, group_type, ldap_group, principal_id FROM groups_info WHERE (group_id = ?) bind => [1 parameter bound] Query: ReadObjectQuery(name="group" referenceClass=GroupEntity )

To resolve this issue, rename the GROUPS table to groups_info in the Ambari backend database.

For MySQL

  1. Log into the MySQL server hosting the Ambari database.

mysql> use ambari;
mysql> show tables lIKE 'groups';
  1. The response is as follows.

+---------------------------+ | Tables_in_ambari (groups) | +---------------------------+ | groups | +---------------------------+
  1. Verify the data.

mysql> select * from `groups`;
  1. Rename the table groups to groups_info using the following command.

mysql> RENAME TABLE `groups` TO groups_info;
  1. Verify the same data as it was in groups table earlier. It must have the same data as it was earlier in groups table.

mysql> select * from groups_info;

For Oracle

  1. Log into the Oracle server hosting the Ambari database.

  2. Verify the existing GROUPS table.

SELECT table_name FROM user_tables WHERE table_name LIKE '%GROUPS%';
  1. The response is as follows.

TABLE_NAME -------------------------------------------------------------------------------------------------------------------------------- GROUPS
  1. Rename the table groups to groups_info using the following command.

SQL> RENAME GROUPS TO GROUPS_INFO ;

The successful rename operation results the output as TABLE Renamed.

  1. Verify the data once renaming is completed.

For Postgres

  1. Log into the Postgres server hosting the Ambari database.

  2. Verify the existing GROUPS table.

ambari=> \dt+
  1. The response is as follows.

.. public | extensionlink | table | ambari | 0 bytes | public | groups | table | ambari | 16 kB | ..
  1. Rename the table groups to groups_info using the following command.

ambari=> ALTER TABLE groups RENAME TO groups_info;


  Last updated