Tag: hadoop

执行中出现Hadoop错误:键入map中的键不匹配:期望org.apache.hadoop.io.Text,收到org.apache.hadoop.io.LongWritable

我正在Hadoop上实现一个PageRank算法,正如标题所示,我在尝试执行代码时想出了以下错误: 键入map中的键不匹配:期望org.apache.hadoop.io.Text,收到org.apache.hadoop.io.LongWritable 在我的输入文件中,我将图形节点ID作为键存储,并将它们的一些信息存储为值。 我的输入文件格式如下: 1 \ t 3.4,2,5,6,67 4 \ t 4.2,77,2,7,83 …… 试图理解错误说明我尝试使用LongWritable作为我的主变量类型,如下面的代码所示。 这意味着我有: map reduce 但是,我也尝试过: 地图 减少 并且: map reduce 我总是想出同样的错误。 我想我无法理解错误中的预期和接收方式。 这是否意味着我的地图函数从我的输入文件中得到LongWritable并且它有文本? 我使用的输入文件格式或变量类型是否有问题? 这是完整的代码,你能告诉我要改变什么以及在哪里?: import java.io.IOException; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.lang.Object.*; import org.apache.commons.cli.ParseException; import org.apache.commons.lang.StringUtils; import org.apache.commons.configuration.Configuration; import org.apache.hadoop.security.Credentials; import org.apache.log4j.*; import org.apache.commons.logging.*; import org.apache.hadoop.mapred.*; import org.apache.hadoop.fs.FileSystem; import […]

如何使用Java类运行Hadoop?

我正在关注Hadoop这本书:权威指南 。 我在例3-1中感到困惑。 有一个Java源文件URLCat.java。 我使用javac将其编译为URLCat.class,然后使用jar将其包装到jar中。 书上说要用 % hadoop URLCat hdfs://localhost/user/tom/quangle.txt 运行它。 我尝试了很多不同的方法,比如 % hadoop jar URLCat.jar ……. 但没有奏效。 我有这样的错误: 线程“main”中的exceptionjava.lang.ClassNotFoundException:hdfs:// localhost / user / username / quangle / txt 这是什么原因,我该怎么做?

当尝试从Java中读取HDFS中的文件时,“错误的FS …期望:file:///”

我无法使用Java从HDFS读取文件: String hdfsUrl = “hdfs://:”; Configuration configuration = new Configuration(); configuration.set(“fs.defaultFS”, hdfsUrl); FileSystem fs = FileSystem.get(configuration); Path filePath = new Path(hdfsUrl + “/projects/harmonizome/data/achilles/attribute_list_entries.txt.gz”); FSDataInputStream fsDataInputStream = fs.open(filePath); SEVERE: Servlet.service() for servlet [edu.mssm.pharm.maayanlab.Harmonizome.api.DownloadAPI] in context with path [/Harmonizome] threw exception java.lang.IllegalArgumentException: Wrong FS: hdfs://146.203.54.165:8020/projects/harmonizome/data/achilles/attribute_list_entries.txt.gz, expected: file:/// at org.apache.hadoop.fs.FileSystem.checkPath(FileSystem.java:310) at org.apache.hadoop.fs.RawLocalFileSystem.pathToFile(RawLocalFileSystem.java:47) at org.apache.hadoop.fs.RawLocalFileSystem.getFileStatus(RawLocalFileSystem.java:357) at org.apache.hadoop.fs.FilterFileSystem.getFileStatus(FilterFileSystem.java:245) at org.apache.hadoop.fs.ChecksumFileSystem$ChecksumFSInputChecker.(ChecksumFileSystem.java:125) […]

在Hadoop 2上运行作业时无法初始化集群exception

问题与我之前的问题相关联所有守护进程都在运行,jps显示: 6663 JobHistoryServer 7213 ResourceManager 9235 Jps 6289 DataNode 6200 NameNode 7420 NodeManager 但wordcount示例继续失败,出现以下exception: ERROR security.UserGroupInformation: PriviledgedActionException as:root (auth:SIMPLE) cause:java.io.IOException: Cannot initialize Cluster. Please check your configuration for mapreduce.framework.name and the correspond server addresses. Exception in thread “main” java.io.IOException: Cannot initialize Cluster. Please check your configuration for mapreduce.framework.name and the correspond server addresses. at org.apache.hadoop.mapreduce.Cluster.initialize(Cluster.java:120) […]

使用hadoop运行jar时的NoSuchMethodError Sets.newConcurrentHashSet()

我正在使用带有hadoop 2.2.0的 cassandra-all 2.0.7 api。 4.0.0 zazzercode doctorhere-engine-writer 1.0 jar DoctorhereEngineWriter UTF-8 2.0.7 1.0-2 15.0 2.2.0 org.apache.maven.plugins maven-compiler-plugin 2.3.2 1.6 1.6 maven-assembly-plugin zazzercode.DiseaseCountJob jar-with-dependencies junit junit 3.8.1 test me.prettyprint hector-core ${hector.version} org.apache.thrift libthrift org.apache.cassandra cassandra-all ${cassandra.version} libthrift org.apache.thrift org.apache.cassandra cassandra-thrift ${cassandra.version} libthrift org.apache.thrift org.apache.hadoop hadoop-client ${hadoop.version} org.apache.thrift libthrift 0.7.0 com.google.guava guava ${guava.version} com.googlecode.concurrentlinkedhashmap concurrentlinkedhashmap-lru 1.3 […]

Hadoop构建在Windows中失败:native.sln缺少zconf.h?

我正在尝试使用Windows 10 Home Edition在开发计算机上构建以下hadoop版本 Hadoop的2.7.3-SRC 以下是有关我本地开发环境的详细信息: -Windows 10家庭版 -Intel Core i5-6200U CPU @ 2.30GHz -RAM 16 GB -64位操作系统,基于x64的处理器 -Microsoft Visual Studio Community 2015版本14.0.25431.01更新3 – 还将MSBUILD位置添加为C:\ Program Files(x86)\ MSBuild \ 14.0 \ Bin \ amd64到Windows系统环境变量路径 -.NET Framework 4.6.01586 -cmake版本3.7.2 -CYGWIN_NT-10.0 LTPBCV82DUG 2.7.0(0.306 / 5/3)2017-02-12 13:18 x86_64 Cygwin -java版“1.8.0_121” -Java(TM)SE运行时环境(版本1.8.0_121-b13) -Java HotSpot(TM)64位服务器VM(内置25.121-b13,混合模式) -Apache Maven 3.3.9(bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T11:41:47-05:00) -Google […]

YarnException:未经授权的启动容器的请求

我在3个集群上设置了hadoop2.2.0。 一切都很顺利。 NodeManager和Datanode在每个集群中启动。 但是,当我运行wordcount示例时,会发生100%映射,并给出以下exception: map 100% reduce 0% 13/11/28 09:57:15 INFO mapreduce.Job: Task Id : attempt_1385611768688_0001_r_000000_0, Status : FAILED Container launch failed for container_1385611768688_0001_01_000003 : org.apache.hadoop.yarn.exceptions. YarnException: Unauthorized request to start container. This token is expired. current time is 1385612996018 found 1385612533275 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 我已经通过互联网找出解决方案。 但我无法找到。 帮帮我。

如何在map reduce程序中解析PDF文件?

我想在我的hadoop 2.2.0程序中解析PDF文件,我发现了这个 ,按照它的说法,直到现在,我有这三个类: PDFWordCount :包含map和reduce函数的主类。 (就像本机hadoop wordcount示例,但我使用的是PDFInputFormat类而不是TextInputFormat 。 PDFRecordReader extends RecordReader :这是主要的工作。 特别是我把initialize函数放在这里以获得更多插图。 public void initialize(InputSplit genericSplit, TaskAttemptContext context) throws IOException, InterruptedException { System.out.println(“initialize”); System.out.println(genericSplit.toString()); FileSplit split = (FileSplit) genericSplit; System.out.println(“filesplit convertion has been done”); final Path file = split.getPath(); Configuration conf = context.getConfiguration(); conf.getInt(“mapred.linerecordreader.maxlength”, Integer.MAX_VALUE); FileSystem fs = file.getFileSystem(conf); System.out.println(“fs has been opened”); start […]

java.lang.NoSuchFieldError:IBM_JAVA,用于Eclipse中的简单hbase Java客户端

标题是。我的源代码是: package hbase; import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.client.HBaseAdmin; import org.apache.hadoop.hbase.util.Bytes; public class HbaseExampleClient { public static void main(String[] args) throws IOException { Configuration config = HBaseConfiguration.create(); config.set(“hbase.zookeeper.quorum”, “192.168.10.17”); config.set(“hbase.zookeeper.property.clientPort”, “2222”); HBaseAdmin admin = new HBaseAdmin(config);//reports an IBM_JAVA NoSuchFieldError HTableDescriptor htd = new HTableDescriptor(“test1111”); HColumnDescriptor hcd = new HColumnDescriptor(“data”); […]

Hadoop从Hadoop节点的本地文件系统访问第三方库

我在/home/ubuntu/libs/javacv-0.9.jar上的所有Hadoop节点上都有一个jar文件,还有一些其他jar文件。 当我的MapReduce应用程序在Hadoop节点上执行时,我遇到了这个exception java.io.FileNotFoundException: File does not exist hdfs://192.168.0.18:50000/home/ubuntu/libs/javacv-0.9.jar 我该如何解决此exception? 我的jar如何在Hadoop中运行从Hadoop节点的本地文件系统访问第三方库?