gpt4 book ai didi

PostgreSQL - fatal error : Ident authentication failed for user

转载 作者:行者123 更新时间:2023-11-29 11:24:04 24 4
gpt4 key购买 nike

我在数据库 mytestdb 中创建了一个名为 employees 的简单表

我想将这个表导入到 hdfs 中。

bin/sqoop import --connect 'jdbc:postgresql://127.0.0.1/mytestdb' --username user -P --table employees --target-dir /user/postgres

但是,我一直收到错误消息:

WARNING: SQLException occurred while connecting to 127.0.0.1:5432 org.postgresql.util.PSQLException: FATAL: Ident authentication failed for user "user" at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:473)

/var/lib/pgsql/data/pg_hba.conf设置如下:

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local all all md5
# IPv4 local connections:
host all all 127.0.0.1/32 ident
# IPv6 local connections:
host all all ::1/128 ident
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication postgres peer
#host replication postgres 127.0.0.1/32 ident
#host replication postgres ::1/128 ident

最佳答案

我从网络上的几个不同来源的组合中找到了一个可行的解决方案。

编辑配置文件

nano /var/lib/pgsql/data/pg_hba.configuration

用 md5 替换前两个 ident,如下所示:

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local all all md5
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication postgres peer
#host replication postgres 127.0.0.1/32 ident
#host replication postgres ::1/128 ident

保存文件。

然后,重启服务器

sudo systemctl restart postgresql

最后,将数据库testdb的所有权限授予hduser;

关于PostgreSQL - fatal error : Ident authentication failed for user,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50085286/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com