Setup Ambari Server

The Ambari Server must be setup before attempting to install Hadoop. If your PostgreSQL instance is configured to listen on the default port number, simply run the following command:

 ambari-server setup

This command will prompt for user input to make several decisions:

  • User Account – you can choose to use another user, different from root to run the daemon process ambari-server on the admin node. If you decide to use a different user and the user does not yet exist, it will be created.

  • Java JDK – Enter 2 at the prompt to select and download the JDK.

  • Database: - Enter n at the Enter advanced database configuration prompt to use the default, embedded PostgreSQL database for Ambari. The default PostgreSQL database name is ambari and use the default user name/password. If you would like to use an existing PostgreSQL database with Ambari instead of the default, Enter y at the prompt and provide the connection parameters for the existing database.

If your PostgreSQL instance is configured to listen on a non-default port number, perform these alternate steps to configure postgres and Ambari:

  • Open the PostgreSQL /var/lib/pgsql/data/pg_hba.conf configuration file in a text editor. Append the following lines to the end of the file to allow the ambari user to connect to the database:

Local all ambari md5
host all ambari 0.0.0.0/0  md5 
host all ambari ::/0 md5n
  • Open the /etc/sysconfig/pgsql/postgresql to enable the non-default port. For example, to use port 10432 the file would need the line:

PGPORT=10432
  • Restart the PostgreSQL database:

service postgresql restart

Connect to the database as postgres (superuser) and configure the database for Ambari:

psql -U postgres -p 10432;
postgres=# CREATE DATABASE ambari;
postgres=# CREATE USER ambari WITH ENCRYPTED PASSWORD 'changeme';
postgres=# \c ambari
ambari=# CREATE SCHEMA ambari AUTHORIZATION ambari;
ambari=# ALTER SCHEMA ambari OWNER TO ambari;
ambari=# ALTER ROLE ambari SET search_path to 'ambari','public';
ambari=# \q
  • Execute this command to setup Ambari:

ambari-server setup --database=postgres --databasehost=localhost --
databaseport=10432 --databasename=ambari --databaseusername=ambari --
databasepassword=changeme

Note: Use the following command to verify that postgres is listening on the hostname value assigned to --databasehost:

  • Execute file Ambari-DDL-Postgres-CREATE.sql in PostgreSQL to complete the configuration:

psql -f /var/lib/ambari-server/resources/Ambari-DDL-Postgres-
CREATE.sql -U ambari -p 10432 -d ambari

Note: Enter the password when prompted.

Last updated