Created 11-30-2017 07:12 PM
I currently have Ambari 2.2.2.0 and want to upgrade to the latest version. My HDP version is 2.4.2.
So I am trying to upgrade to 2.4 first (since I cant jump directly to 2.6 from 2.2) and am following the steps given at: https://docs.hortonworks.com/HDPDocuments/Ambari-2.4.0.1/bk_ambari-upgrade/content/upgrade_ambari.ht....
Everything is good until I rech the "ambari-server upgrade" step. This step fails with the error:
[root@newyorknn ~]# ambari-server upgrade Using python /usr/bin/python Upgrading ambari-server Updating properties in ambari.properties ... WARNING: Original file ambari-env.sh kept Fixing database objects owner Ambari Server configured for Embedded Postgres. Confirm you have made a backup of the Ambari Server database [y/n] (y)? y Upgrading database schema Error output from schema upgrade command: Exception in thread "main" org.apache.ambari.server.AmbariException: ERROR: schema "ambarirca" does not exist at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.executeUpgrade(SchemaUpgradeHelper.java:207) at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.main(SchemaUpgradeHelper.java:347) Caused by: org.postgresql.util.PSQLException: ERROR: schema "ambarirca" does not exist at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2161) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1890) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:559) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:403) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:395) at org.apache.ambari.server.orm.DBAccessorImpl.executeQuery(DBAccessorImpl.java:827) at org.apache.ambari.server.orm.DBAccessorImpl.executeQuery(DBAccessorImpl.java:819) at org.apache.ambari.server.upgrade.AbstractUpgradeCatalog.changePostgresSearchPath(AbstractUpgradeCatalog.java:361) at org.apache.ambari.server.upgrade.AbstractUpgradeCatalog.upgradeSchema(AbstractUpgradeCatalog.java:886) at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.executeUpgrade(SchemaUpgradeHelper.java:204) ... 1 more ERROR: Error executing schema upgrade, please check the server logs. ERROR: Ambari server upgrade failed. Please look at /var/log/ambari-server/ambari-server.log, for more details. ERROR: Exiting with exit code 11. REASON: Schema upgrade failed.
Can someone suggest what I should do? I looked at the ambari-server database files that I backed up according to the instructions given at https://community.hortonworks.com/articles/37765/backing-up-the-ambari-database-with-postgres.html (ambari.sql and ambarirca.sql) but none of them have any command called "CREATE SCHEMA AMBARIRCA". I am not sure how to proceed.
Created 11-30-2017 07:32 PM
RCA Database tables is not used anymore. Please refer to https://issues.apache.org/jira/browse/AMBARI-16692
The Ambari Server upgrade process should detect the presence of these older, deprecated tables, and automate the process of cleaning up this data.
Looks like in your Ambari 2.2.2 DB someone deleted the "ambarirca" database which is causing upgrade steps to not be able to locate that DB for deletion.
Better if you can recover the "ambarirca" database which is usually present inside the Database with Ambari 2.2.2 and then perform the upgrade. Or use the old ambari 2.2.2 DDL to recover the 'ambarirca' db before performing ambari 2.4 upgrade.
As a workaround you might want to try the following to see if it works:
# su postgres -c 'psql -c "create database ambarirca" ' # su postgres -c 'psql -c "create user mapred with password 'mapred'" ' # su postgres -c 'psql -c "GRANT ALL PRIVILEGES ON DATABASE ambarirca TO mapred"'
.
Then perform ambari-server upgrade.
# ambari-server upgrade
.
Created 11-30-2017 07:46 PM
@Jay Kumar SenSharma Did not help. Please check the logs below:
[root@newyorknn ~]# su postgres -c 'psql -c "create database ambarirca" ' ERROR: database "ambarirca" already exists [root@newyorknn ~]# su postgres -c 'psql -c "create user mapred with password 'mapred'" ' ERROR: syntax error at or near "mapred" LINE 1: create user mapred with password mapred ^ [root@newyorknn ~]# su postgres -c 'psql -c "GRANT ALL PRIVILEGES ON DATABASE ambarirca TO mapred"' GRANT [root@newyorknn ~]# ambari-server upgrade Using python /usr/bin/python Upgrading ambari-server Updating properties in ambari.properties ... INFO: Can not find ambari-env.sh.rpmsave file from previous version, skipping restore of environment settings. ambari-env.sh may not include any user customization. Fixing database objects owner Ambari Server configured for Embedded Postgres. Confirm you have made a backup of the Ambari Server database [y/n] (y)? y Upgrading database schema Error output from schema upgrade command: Exception in thread "main" org.apache.ambari.server.AmbariException: ERROR: schema "ambarirca" does not exist at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.executeUpgrade(SchemaUpgradeHelper.java:207) at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.main(SchemaUpgradeHelper.java:347) Caused by: org.postgresql.util.PSQLException: ERROR: schema "ambarirca" does not exist at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2161) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1890) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:559) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:403) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:395) at org.apache.ambari.server.orm.DBAccessorImpl.executeQuery(DBAccessorImpl.java:827) at org.apache.ambari.server.orm.DBAccessorImpl.executeQuery(DBAccessorImpl.java:819) at org.apache.ambari.server.upgrade.AbstractUpgradeCatalog.changePostgresSearchPath(AbstractUpgradeCatalog.java:361) at org.apache.ambari.server.upgrade.AbstractUpgradeCatalog.upgradeSchema(AbstractUpgradeCatalog.java:886) at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.executeUpgrade(SchemaUpgradeHelper.java:204) ... 1 more ERROR: Error executing schema upgrade, please check the server logs. ERROR: Ambari server upgrade failed. Please look at /var/log/ambari-server/ambari-server.log, for more details. ERROR: Exiting with exit code 11. REASON: Schema upgrade failed.
Then, since database and schema are different things in postgres (?), I did the following:
[root@newyorknn ~]# su - postgres Last login: Thu Nov 30 14:41:51 EST 2017 -bash-4.2$ psql -c "create database ambarirca" ERROR: database "ambarirca" already exists -bash-4.2$ psql -c "create schema ambarirca" CREATE SCHEMA -bash-4.2$ psql -c "create user mapred with password 'mapred'" ERROR: role "mapred" already exists -bash-4.2$ psql -c "GRANT ALL PRIVILEGES ON DATABASE ambarirca TO mapred" GRANT -bash-4.2$ psql -c "GRANT ALL PRIVILEGES ON schema ambarirca TO mapred" GRANT -bash-4.2$ exit logout [root@newyorknn ~]# ambari-server upgrade Using python /usr/bin/python Upgrading ambari-server Updating properties in ambari.properties ... WARNING: Can not find ambari.properties.rpmsave file from previous version, skipping import of settings INFO: Can not find ambari-env.sh.rpmsave file from previous version, skipping restore of environment settings. ambari-env.sh may not include any user customization. Fixing database objects owner Ambari Server configured for Embedded Postgres. Confirm you have made a backup of the Ambari Server database [y/n] (y)? y Upgrading database schema Error output from schema upgrade command: Exception in thread "main" org.apache.ambari.server.AmbariException: ERROR: schema "ambarirca" does not exist at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.executeUpgrade(SchemaUpgradeHelper.java:207) at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.main(SchemaUpgradeHelper.java:347) Caused by: org.postgresql.util.PSQLException: ERROR: schema "ambarirca" does not exist at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2161) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1890) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:559) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:403) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:395) at org.apache.ambari.server.orm.DBAccessorImpl.executeQuery(DBAccessorImpl.java:827) at org.apache.ambari.server.orm.DBAccessorImpl.executeQuery(DBAccessorImpl.java:819) at org.apache.ambari.server.upgrade.AbstractUpgradeCatalog.changePostgresSearchPath(AbstractUpgradeCatalog.java:361) at org.apache.ambari.server.upgrade.AbstractUpgradeCatalog.upgradeSchema(AbstractUpgradeCatalog.java:886) at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.executeUpgrade(SchemaUpgradeHelper.java:204) ... 1 more ERROR: Error executing schema upgrade, please check the server logs. ERROR: Ambari server upgrade failed. Please look at /var/log/ambari-server/ambari-server.log, for more details. ERROR: Exiting with exit code 11. REASON: Schema upgrade failed.