sql - 从 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]在访问外部文件时发生。
- 从 core-site.xml 获取外部源位置
- tmp 文件夹被创建并添加了权限给用户并添加到 core-site.xml
- 所有节点都在 Hadoop 中运行 10625 DataNode 10869 SecondaryNameNode 17113 ResourceManager 17434 NodeManager 10490 NameNode 21566 Jps
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>
有什么需要改变的吗?
解决方案
这里的问题是 cores-site.xml 文件包含 hdfs://localhost:54310 需要将这个替换为对应的 IP 地址 hdfs://xxx.xxx.xx:54310。
推荐阅读
- node.js - 收到来自 IDP 的回调后如何在服务器端使用 Meteor 登录用户 [已解决]
- java - Spring Autowired 和 Builder 注释
- sql - Postgresql - 从 [] 值中提取 json 值
- reactive - reactive 4 2 0 Repeat 和 FirstAsync 会一起工作吗?
- java - 带有 If 语句和随机数的 Java
- multithreading - 内存泄漏,线程滥用?
- c++ - Qt/C++:如何将浮点数舍入到最接近的正数,最多保留 2 位小数
- reporting-services - 如何重新排序 SSRS 上的列组?
- kubernetes - 如何在 Longhorn 中保留 PersistenceVolume
- python - 如何从另一个函数获取消息 ID