Before setting up Ambari Sever with an existing PostgreSQL database; obtain the
appropriate connectors and .jar files, create an Ambari user with sufficient permissions, and
load the Ambari database schema.
Determine the appropriate database version and obtain the
release drivers and .jar file.
-
On the Ambari Server host, stage the appropriate JDBC driver file for later
deployment.
-
On the Ambari server host, Download the PostgreSQL JDBC Driver from
PostgreSQL.
-
Run
ambari-server setup --jdbc-db=postgres
--jdbc-driver=/path/to/postgres/postgresql.jar
-
Create a user for Ambari and grant it permissions.
Using the PostgreSQL database admin
utility:
# sudo -u postgres psql
CREATE DATABASE [AMBARI_DATABASE];
CREATE USER [AMBARI_USER] WITH PASSWORD '[AMBARI_PASSWORD]';
GRANT ALL PRIVILEGES ON DATABASE [AMBARI_DATABASE] TO [AMBARI_USER];
\connect [AMBARI_DATABASE];
CREATE SCHEMA [AMBARI_SCHEMA] AUTHORIZATION [AMBARI_USER];
ALTER SCHEMA [AMBARI_SCHEMA] OWNER TO [AMBARI_USER];
ALTER ROLE [AMBARI_USER] SET search_path to '[AMBARI_SCHEMA]', 'public';
Where [AMBARI_USER] is the Ambari user name
[AMBARI_PASSWORD] is the Ambari user password,
[AMBARI_DATABASE] is the Ambari database name and
[AMBARI_SCHEMA] is the Ambari schema name.
-
Load the Ambari Server database schema.
You must pre-load the Ambari database schema into your PostgreSQL database using
the schema script.
# psql -U [AMBARI_USER] -d [AMBARI_DATABASE]
\connect [AMBARI_DATABASE];
\i Ambari-DDL-Postgres-CREATE.sql;
Find the Ambari-DDL-Postgres-CREATE.sql file in the
/var/lib/ambari-server/resources/ directory of the Ambari
Server host after you have installed Ambari Server.
When setting up the Ambari Server, select
Advanced Database Configuration > Option[4] PostgreSQL and enter
the credentials you defined in Step 2. for user name, password, and database
name.