Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Issue setting up Ambari-2.6 with Standalone Postgresdb-9.2 unable to start Ambari server

Issue setting up Ambari-2.6 with Standalone Postgresdb-9.2 unable to start Ambari server

New Contributor

Hi all,

I'm trying to setup Amabri with standalone postgresdb. Below are the steps followed.

Postgres setup:

#login with postgres user and setup the database.

sudo -u postgres psql CREATE DATABASE ambaridb; CREATE USER ambari WITH PASSWORD 'ambari123'; GRANT ALL PRIVILEGES ON DATABASE ambaridb TO ambari; \connect ambaridb; CREATE SCHEMA ambarischema AUTHORIZATION ambari; ALTER SCHEMA ambarischema OWNER TO ambari; ALTER ROLE ambari SET search_path to 'ambarischema', 'public';

Step-2: Load the Ambari Server database schema

psql -U ambari -d ambaridb

\connect ambaridb;

\i /var/lib/ambari-server/resources/Ambari-DDL-Postgres-CREATE.sql;

<code>ambari-server setup

#custom user account: n #confirm iptables: y #select JDK: 1 #Accept crpyto policy: y #Enter advanced database: y #Database Postgres External: 4 #Hostname: localhost #Port: 5432 #DBname: ambaridb #Schema: ambarischema #username ambari #password: ambari123 #reenter: ambari123 #Proceed: y

ERROR in ambari-server.log

ERROR [main] DBAccessorImpl:119 - Error while creating database accessor org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections<br>

Followed document:https://docs.hortonworks.com/HDPDocuments/Ambari-2.6.2.0/bk_ambari-administration/content/using_amba...

Note: I tried with embedded postgres setup am able to start Ambari server.

Please let me know how to resolve this issue.

@Jay Kumar SenSharma

avatar image

3 REPLIES 3

Re: Issue setting up Ambari-2.6 with Standalone Postgresdb-9.2 unable to start Ambari server

Super Mentor

@Raj K

Please check your Postgres DB to verify if you have the external postgres settings correctly done?

Like:

# grep 'listen_addresses' /var/lib/pgsql/data/pg_hba.conf
listen_addresses = '*'

# grep 'port' /var/lib/pgsql/data/pg_hba.conf
port = 5432

.

Check if the postgres listen port 5432 is bind properly and listening to which address using the following command:

# netstat -tnlpa | grep 5432
#  netstat -ltnp | grep postgres
tcp        0      0 0.0.0.0:5432            0.0.0.0:*               LISTEN      914/postgres        
tcp6       0      0 :::5432                 :::*                    LISTEN      914/postgres  

Check if you have given proper permission to for ambaridb inside the conf or not?

# grep 'local' /var/lib/pgsql/data/pg_hba.conf
local   all   postgres                                     peer
local  all  ambariview,ambari,ambaridb,mapred md5

.

Additionally it will be better to specify the Database host name to the FQDN instead of using "localhost"

Re: Issue setting up Ambari-2.6 with Standalone Postgresdb-9.2 unable to start Ambari server

Super Mentor

@Raj K

If this resolved/answers your query/issue then please mark this HCC thread as answered by clicking on "Accept" link on the correct answer, That way it will help other HCC users to quickly find the answers.

Highlighted

Re: Issue setting up Ambari-2.6 with Standalone Postgresdb-9.2 unable to start Ambari server

New Contributor

Thanks Jay. I'm able to start Ambari server now.