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
$AMBARIUSER
is the Ambari user name,$AMBARIPASSWORD
is the Ambari user password,$AMBARIDATABASE
is the Ambari database name and$AMBARISCHEMA
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 $AMBARIUSER -d $AMBARIDATABASE \connect $AMBARIDATABASE; \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.