代码改变世界

Ambari postpresql 无法启动 FATAL: no pg_hba.conf entry

2014-05-19 14:15  programmer022  阅读(1516)  评论(0)    收藏  举报

PostgreSQ数据库为了安全,它不会监听除本地以外的所有连接请求,当用户通过JDBC访问是,会报一些如下的异常:

Caused by: org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host "127.0.0.1", user "ambari", database "ambari", SSL off
at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:291)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:108)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66)

启动ambari-server时遇到以上问题:

#vi /var/lib/pgsql/data/pg_hba.conf

增加内容

# IPv4 local connections:
host    all             all             127.0.0.1/32            md5

32是子网掩码的网段;md5是密码验证方法

添加成功后,重新启动postgresql数据库

#/etc/init.d/postgresql restart

最后,启动ambari-server