无法在 PostgreSQL 的 ambari 服务器设置中验证用户"ambari"



我正在单一实例RHEL 7节点上设置Hortonworks Hadoop堆栈。我被困在我正在设置我的ambari-server的部分,使用我的PostgreSQL 9.2.15数据库(不是默认的,不是嵌入式的)。

我还打算在Hive和Oozie中使用相同的PostgreSQL实例。

按照这里的说明操作后:

https://docs.hortonworks.com/HDPDocuments/Ambari-2.2.2.0/bk_ambari_reference_guide/content/_using_ambari_with_postgresql.html

https://docs.hortonworks.com/HDPDocuments/Ambari-2.2.2.0/bk_ambari_reference_guide/content/_using_hive_with_postgresql.html

https://docs.hortonworks.com/HDPDocuments/Ambari-2.2.2.0/bk_ambari_reference_guide/content/_using_oozie_with_postgresql.html

下面是我如何命名我的数据库,用户和模式:
ambari, ambari, ambari
hive, hive
oozie, oozie

这是我如何配置我的/var/lib/pgsql/data/pg_hba.conf文件:

# Default
local   all     all     peer
host    all     all     127.0.0.1/32    ident
# added settings
local   all     ambari  md5
host    all     ambari  0.0.0.0/0   md5
host    all     ambari  ::/0        md5
host    oozie   oozie   <my-host-ip>/0  md5
host    hive    hive    <my-host-ip>/0  md5

我运行这个,对于Hive和Oozie:

$ ambari-server setup --jdbc-db=postgres --jdbc-driver=/usr/share/java/postgresql-jdbc.jar

对于实际的Ambari设置

$ ambari-server setup
Enter advanced database configuration [y/n]? y
...
Enter choice (1): 4
Hostname (localhost): <my-fqdn-host-name>
Port (5432):
Database name (ambari):
Postgres schema (ambari):
Username (ambari):
Enter Database Password (bigdata) : <my-ambari-password>

然而,我不能启动ambari-server,因为我从/var/log/ambari-server/ambari-server.log得到了很多行:

Internal Exception: org.postgresql.util.PSQLException: FATAL: Ident authentication failed for user "ambari"

虽然我确信我的密码是正确的,我甚至可以使用

连接
$ psql -h <my-fqdn-host-name> -U ambari -d ambari -W
password: <my-ambari-password>
$ psql -h <my-host-ip> -U ambari -d ambari -W
password: <my-ambari-password>

然而,我无法连接到

$ psql -h localhost -U ambari -d ambari -W
password: <my-ambari-password>
psql: FATAL: Ident authentication failed for user "ambari"
$ psql -h 127.0.0.1 -U ambari -d ambari -W
password: <my-ambari-password>
psql: FATAL: Ident authentication failed for user "ambari"

我得到的错误与我从/var/log/ambari-server/ambari-server.log得到的相同。我怀疑ambari-server setup通过localhost连接,这就是为什么我得到相同的错误。

你能告诉我Ambari和/或Postgres的配置有什么问题吗?

问题是你的pg_hba.conf文件。

从上到下解析,并使用第一个匹配行。
在您的示例中,选择的行是

host    all     all     127.0.0.1/32    ident

(你似乎从本地主机连接)这不是你想要的。

删除该行或将其移动到文件末尾

最新更新