Support Questions

Find answers, ask questions, and share your expertise

PSQLException: FATAL: no pg_hba.conf entry for host "127.0.0.1", user "ambari", database "ambari", SSL off

avatar

Hi,

I'm trying to install ambari 2.2.1. After installed ambari server, i got the error as mentioned below,

Error injecting constructor, java.lang.RuntimeException: org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host "127.0.0.1", user "ambari", database "ambari", SSL off at org.apache.ambari.server.orm.DBAccessorImpl.<init>(DBAccessorImpl.java:77) while locating org.apache.ambari.server.orm.DBAccessorImpl while locating org.apache.ambari.server.orm.DBAccessor for field at org.apache.ambari.server.orm.dao.DaoUtils.dbAccessor(DaoUtils.java:36) at org.apache.ambari.server.orm.dao.DaoUtils.class(DaoUtils.java:36) while locating org.apache.ambari.server.orm.dao.DaoUtils for field at org.apache.ambari.server.orm.dao.HostComponentStateDAO.daoUtils(HostComponentStateDAO.java:39) at org.apache.ambari.server.orm.dao.HostComponentStateDAO.class(HostComponentStateDAO.java:39) while locating org.apache.ambari.server.orm.dao.HostComponentStateDAO for field at org.apache.ambari.server.orm.models.HostComponentSummary.hostComponentStateDao(HostComponentSummary.java:52) Caused by: java.lang.RuntimeException: org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host "127.0.0.1", user "ambari", database "ambari", SSL off

How to solve this problem,

1 ACCEPTED SOLUTION

avatar
Rising Star
@Venkat ramanann

On your Postgres server, you will need to update your pg_hba.conf file to allow access for the ambari user on the ambari database coming from 127.0.0.1.

Here is the location of our pg_hba.conf file: /data/pghadoop/pg_hba.conf

If its not there, run: find / -name pg_hba.conf

Here is Postgres documentation for configuring this file: http://www.postgresql.org/docs/9.5/static/auth-pg-hba-conf.html

This is what our pg_hba.conf file has for the ambari user:

local  all  ambari trust 
host  all   ambari 0.0.0.0/0  trust 
host  all   ambari ::/0 trust

Once you have made these changes, you will need to restart the Postgres server:

/etc/init.d/postgresql restart

Let me know if you have any other questions.

View solution in original post

2 REPLIES 2

avatar
Rising Star
@Venkat ramanann

On your Postgres server, you will need to update your pg_hba.conf file to allow access for the ambari user on the ambari database coming from 127.0.0.1.

Here is the location of our pg_hba.conf file: /data/pghadoop/pg_hba.conf

If its not there, run: find / -name pg_hba.conf

Here is Postgres documentation for configuring this file: http://www.postgresql.org/docs/9.5/static/auth-pg-hba-conf.html

This is what our pg_hba.conf file has for the ambari user:

local  all  ambari trust 
host  all   ambari 0.0.0.0/0  trust 
host  all   ambari ::/0 trust

Once you have made these changes, you will need to restart the Postgres server:

/etc/init.d/postgresql restart

Let me know if you have any other questions.

avatar
Expert Contributor

@ Venkat ramanann

In addition to @Jon Maestas workaround, add the IP address of the host (on which PostgreSQL server is running) to the pg_hba.conf file and make sure that the method is set to "trust".

Note: Replace <ip address> with the IP address of your host to allow connections.

# TYPE DATABASE USER CIDR-ADDRESS METHOD

# IPv4 local connections:

host all all 127.0.0.1/32 md5

host all all <ip address>/24 trust

# IPv6 local connections: host all all ::1/128 md5

Now, restart postgresql service.

For more details, visit https://confluence.atlassian.com/confkb/confluence-unable-to-connect-to-postgresql-due-to-unconfigur...