【问题标题】:Can't authenticate user "ambari" in ambari-server setup in PostgreSQL无法在 PostgreSQL 的 ambari-server 设置中验证用户“ambari”
【发布时间】:2017-02-12 10:43:15
【问题描述】:

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

我还打算将同一个 PostgreSQL 实例用于 Hive 和 Oozie。

按照此处的说明操作后:

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 配置有什么问题吗?

【问题讨论】:

    标签: postgresql postgresql-9.2 hortonworks-data-platform ambari rhel7


    【解决方案1】:

    问题在于您的pg_hba.conf 文件。

    从上到下解析,使用第一个匹配行。
    在您的情况下,选择的行是

    host    all     all     127.0.0.1/32    ident
    

    (你似乎是从 localhost 连接的)这不是你想要的。

    删除该行或将其移至文件末尾。

    【讨论】:

    • 大破解。拯救了我的一天!
    猜你喜欢
    • 2020-08-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多