简体   繁体   English

Hadoop客户端不断从本地文件系统读取

[英]Hadoop Client Keeps Reading from Local File System

I'm trying to read a file via the Hadoop client from a Java program on windows. 我正在尝试通过Hadoop客户端从Windows上的Java程序读取文件。 I have a valid kerberos keytab, but can't seem to read from HDFS. 我有一个有效的kerberos keytab,但似乎无法从HDFS中读取。

I'm using the example from this page and the hadoop client keeps reading from the local file system. 我正在使用页面中的示例,hadoop客户端不断从本地文件系统读取内容。 I triple checked the URL I'm using & its correct, what am I missing? 我三重检查了我使用的URL及其正确的URL,我缺少了什么?

Configuration conf = new Configuration();
conf.set("fs.defaultFS", "hdfs://test.hdp:8020");
conf.set("hadoop.security.authentication", "kerberos");

UserGroupInformation.setConfiguration(conf);
UserGroupInformation.loginUserFromKeytab("hdfs-user@MYCORP.NET", 
   "c:/temp/hdfs-user.keytab");

FileSystem fs = FileSystem.get(conf);
FileStatus[] fsStatus = fs.listStatus(new Path("/"));
for(int i = 0; i < fsStatus.length; i++){
  System.out.println(fsStatus[i].getPath().toString());
}

I found the issue. 我发现了问题。 The project where the Hadoop Client was reading from the local FS was also trying to integrate Hadoop with Apache & Active MQ. Hadoop客户端从本地FS读取的项目也试图将Hadoop与Apache&Active MQ集成。 The version of activemq-camel I was using was bring an older Hadoop library that was causing the issue. 我正在使用的activemq-camel版本带来了一个较旧的Hadoop库,这是导致此问题的原因。 I updated to the latest versions of Camel & Active MQ & the issue went away. 我已更新到最新版本的Camel和Active MQ,问题就消失了。 I verified that the newer versions do not bring in any hadoop depedencies. 我验证了较新的版本不会带来任何hadoop缺陷。

activemq-camel 5.6 Dependencies ( partial list)
[INFO] \- org.apache.activemq:activemq-camel:jar:5.6.0:compile
[INFO]    +- org.apache.camel:camel-jms:jar:2.9.2:compile
[INFO]    \- org.apache.activemq:activemq-core:jar:5.6.0:compile
[INFO]       +- org.fusesource.fuse-extra:fusemq-leveldb:jar:1.1:compile
[INFO]       |  +- org.apache.hadoop:hadoop-core:jar:1.0.0:compile

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM