作者:思路 | 来源:互联网 | 2022-12-19 09:51
我在postgres中创建了一个简单的表,称为employees
数据库mytestdb
我想将此表导入hdfs。
bin/sqoop import --connect 'jdbc:postgresql://127.0.0.1/mytestdb' --username user -P --table employees --target-dir /user/postgres
但是,我不断收到错误:
警告:连接到127.0.0.1:5432 org.postgresql.util.PSQLException时发生SQLException:致命:org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:473)上的用户“ user”的身份验证失败
/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
usr..
7
我从网络上的多个不同来源中找到了可行的解决方案。
编辑配置文件
nano /var/lib/pgsql/data/pg_hba.configuration
ident
用md5 替换前两个,如下所示:
# 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
最后, grant all privileges on database testdb to hduser;
1> usr..:
我从网络上的多个不同来源中找到了可行的解决方案。
编辑配置文件
nano /var/lib/pgsql/data/pg_hba.configuration
ident
用md5 替换前两个,如下所示:
# 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
最后, grant all privileges on database testdb to hduser;