To set up PostgreSQL for use with Ambari:
Create a user for Ambari and grant it permissions.
Using the PostgreSQL database admin utility:
# sudo -u postgres psql CREATE DATABASE $AMBARIDATABASE; CREATE USER $AMBARIUSER WITH PASSWORD ‘$AMBARIPASSWORD’; GRANT ALL PRIVILEGES ON DATABASE $AMBARIDATABASE TO $AMBARIUSER; \connect $AMBARIDATABASE; CREATE SCHEMA $AMBARISCHEMA AUTHORIZATION $AMBARIUSER; ALTER SCHEMA $AMBARISCHEMA OWNER TO $AMBARIUSER; ALTER ROLE $AMBARIUSER SET search_path to ‘$AMBARISCHEMA’, 'public';
Where
$AMBARIUSERis the Ambari user name,$AMBARIPASSWORDis the Ambari user password,$AMBARIDATABASEis the Ambari database name and$AMBARISCHEMAis 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 $AMBARIUSER -d $AMBARIDATABASE \connect $AMBARIDATABASE; \i Ambari-DDL-Postgres-CREATE.sql;
Find the
Ambari-DDL-Postgres-CREATE.sqlfile 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] PostgreSQLand enter the credentials you defined in Step 2. for user name, password and database name.

