首页 > 解决方案 > 从 polybase 连接到 hadoop 时连接被拒绝

问题描述

尝试在 Ubuntu 16.04 中创建从 sql server 2017 到 Hadoop 的外部表时,会引发以下错误

消息 105019,级别 16,状态 1,行 1 外部表访问因内部错误而失败:'调用 HdfsBridge_IsDirExist 时引发 Java 异常。Java 异常消息:从 DESKTOP-VE8KNAG/xxx.xxx.x.xxx 调用到 xxx.xxx.xx:54310 连接异常失败:java.net.ConnectException:连接被拒绝:没有更多信息;有关更多详细信息,请参阅: http ://wiki.apache.org/hadoop/ConnectionRefused:错误 [从 DESKTOP-VE8KNAG/1xxx.xxx.x.xxx 调用到 xxx.xxx.xx:54310 连接异常失败:java.net .ConnectException:连接被拒绝:没有更多信息;有关更多详细信息,请参阅: http://wiki.apache.org/hadoop/ConnectionRefused]在访问外部文件时发生。

sql查询

create EXTERNAL DATA SOURCE [HDP2] 
WITH (TYPE = HADOOP,
 LOCATION = N'hdfs://xxx.xxx.x.x:54310',
 CREDENTIAL = [HDPUser])
GO

create EXTERNAL TABLE [dbo].CLASS_DIM_EXP (
    [CLASS_ID] [varchar](8) NOT NULL,
    [CLASS_DESC] [varchar](100) NULL,
    [INSERT_DATE] [datetime2](7) NOT NULL,
    [LAST_UPDATE_DATETIME] [datetime2](7) NOT NULL)
WITH   (LOCATION='/user/pdw_user',
DATA_SOURCE = HDP2,
FILE_FORMAT = TSV,
REJECT_TYPE = VALUE,
REJECT_VALUE = 0);

核心站点.xml

<property>
  <name>hadoop.tmp.dir</name>
  <value>/app/hadoop/tmp</value>
  <description>A base for other temporary directories.</description>
</property>

<property>
  <name>fs.default.name</name>
  <value>hdfs://localhost:54310</value>
  <description>The name of the default file system.  A URI whose
  scheme and authority determine the FileSystem implementation.  The
  uri's scheme determines the config property (fs.SCHEME.impl) naming
  the FileSystem implementation class.  The uri's authority is used to
  determine the host, port, etc. for a filesystem.</description>
</property>

有什么需要改变的吗?

标签: sqlsql-servertsqlhadooppolybase

解决方案


这里的问题是 cores-site.xml 文件包含 hdfs://localhost:54310 需要将这个替换为对应的 IP 地址 hdfs://xxx.xxx.xx:54310。


推荐阅读