【发布时间】:2017-10-17 16:28:05
【问题描述】:
我的本地计算机 (Windows) 上有一个 PostgreSQL 数据库,我想使用 Apache Sqoop 将它导入我的 Hortonworks Sandbox。虽然this 之类的东西听起来不错,但复杂的因素是我的沙箱位于 Docker 容器中,因此sqoop list-tables --connect jdbc:postgresql://127.0.0.1/ambari --username ambari -P 之类的语句似乎会遇到身份验证错误。我认为问题出在尝试从 docker 容器内部连接到本地主机。
我查看了this post 从容器内连接到 MySQL DB 和 this one 尝试改用 PostgreSQL,但到目前为止都没有成功。我尝试连接到“127.0.0.1”和“172.17.0.1”(主机的 IP),以便从 Docker 中连接到我的本地主机。我还调整了 PostgreSQL 的配置文件以侦听所有 IP 地址上的连接。但是,当我运行sqoop list-tables --connect jdbc:postgresql://<ip>:5432/<db_name> --username postgres -P 时,我仍然收到以下错误消息(其中<ip> 是127.0.0.1 或172.17.0.1,<db_name> 是我的数据库的名称)
用于连接127.0.0.1:
ERROR sqoop.Sqoop: Got exception running Sqoop: java.lang.RuntimeException: org.postgresql.util.PSQLException: FATAL: Ident authentication failed for user "postgres"
用于连接172.17.0.1:
Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
任何建议都会非常有帮助!
【问题讨论】:
标签: postgresql hadoop docker sqoop hortonworks-sandbox