zoukankan      html  css  js  c++  java
  • hadoop运行mahout问题解决方法

     问题1:

    1. java.lang.IncompatibleClassChangeError:Found interface org.apache.hadoop.mapreduce.JobContext, but class was expected
      at org.apache.mahout.common.HadoopUtil.getCustomJobName(HadoopUtil.java:174)
      at org.apache.mahout.common.AbstractJob.prepareJob(AbstractJob.java:614)
      at org.apache.mahout.cf.taste.hadoop.preparation.PreparePreferenceMatrixJob.run(PreparePreferenceMatrixJob.java:73)
      at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
    hadoop还不能支持hadoop1
     

     问题2:

    1. [root@crxy170 ~]# mahout hadoop jar jar.jar cmd.client.app.ClientAPP
      MAHOUT_LOCAL is not set; adding HADOOP_CONF_DIR to classpath.
      Running on hadoop, using /usr/lib/hadoop/bin/hadoop and HADOOP_CONF_DIR=/etc/hadoop/conf
      SLF4J:Class path contains multiple SLF4J bindings.
      SLF4J:Found binding in[jar:file:/usr/lib/zookeeper/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
      SLF4J:Found binding in[jar:file:/usr/local/hbase-0.98.8-hadoop2/lib/slf4j-log4j12-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
      SLF4J:Found binding in[jar:file:/usr/local/mahout0.9/mahout-core-0.9-job.jar!/org/slf4j/impl/StaticLoggerBinder.class]
      SLF4J:See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
      SLF4J:Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
      14/12/0600:10:32 INFO common.AbstractJob:Command line arguments:{--booleanData=[true],--endPhase=[2147483647],--input=[hdfs://192.168.1.170:8020/user/root/userCF],--maxPrefsInItemSimilarity=[500],--maxPrefsPerUser=[10],--maxSimilaritiesPerItem=[100],--minPrefsPerUser=[1],--numRecommendations=[10],--output=[hdfs://192.168.1.170:8020/user/root/userCF/result/],--similarityClassname=[org.apache.mahout.math.hadoop.similarity.cooccurrence.measures.EuclideanDistanceSimilarity],--startPhase=[0],--tempDir=[hdfs://192.168.1.170:8020/tmp/1417795832292]}
      14/12/0600:10:32 INFO common.AbstractJob:Command line arguments:{--booleanData=[true],--endPhase=[2147483647],--input=[hdfs://192.168.1.170:8020/user/root/userCF],--minPrefsPerUser=[1],--output=[hdfs://192.168.1.170:8020/tmp/1417795832292/preparePreferenceMatrix],--ratingShift=[0.0],--startPhase=[0],--tempDir=[hdfs://192.168.1.170:8020/tmp/1417795832292]}
      14/12/0600:10:33 INFO Configuration.deprecation: mapred.input.dir is deprecated.Instead, use mapreduce.input.fileinputformat.inputdir
      14/12/0600:10:33 INFO Configuration.deprecation: mapred.compress.map.output is deprecated.Instead, use mapreduce.map.output.compress
      14/12/0600:10:33 INFO Configuration.deprecation: mapred.output.dir is deprecated.Instead, use mapreduce.output.fileoutputformat.outputdir
      14/12/0600:10:33 INFO client.RMProxy:Connecting to ResourceManager at crxy171.crxy/192.168.1.171:8032
      14/12/0600:10:35 INFO input.FileInputFormat:Total input paths to process :1
      14/12/0600:10:35 INFO mapreduce.JobSubmitter: number of splits:1
      14/12/0600:10:35 INFO mapreduce.JobSubmitter:Submitting tokens for job: job_1417519292729_0030
      14/12/0600:10:35 INFO impl.YarnClientImpl:Submitted application application_1417519292729_0030
      14/12/0600:10:35 INFO mapreduce.Job:The url to track the job: http://crxy171.crxy:8088/proxy/application_1417519292729_0030/
      14/12/0600:10:35 INFO mapreduce.Job:Running job: job_1417519292729_0030
      14/12/0600:10:43 INFO mapreduce.Job:Job job_1417519292729_0030 running in uber mode : false
      14/12/0600:10:43 INFO mapreduce.Job: map 0% reduce 0%
      14/12/0600:10:49 INFO mapreduce.Job: map 100% reduce 0%
      14/12/0600:10:56 INFO mapreduce.Job: map 100% reduce 100%
      14/12/0600:10:56 INFO mapreduce.Job:Job job_1417519292729_0030 completed successfully
      14/12/0600:10:56 INFO mapreduce.Job:Counters:49
      FileSystemCounters
      FILE:Number of bytes read=54
      FILE:Number of bytes written=182573
      FILE:Number of read operations=0
      FILE:Number of large read operations=0
      FILE:Number of write operations=0
      HDFS:Number of bytes read=326
      HDFS:Number of bytes written=187
      HDFS:Number of read operations=6
      HDFS:Number of large read operations=0
      HDFS:Number of write operations=2
      JobCounters
      Launched map tasks=1
      Launched reduce tasks=1
      Rack-local map tasks=1
      Total time spent by all maps in occupied slots (ms)=3962
      Total time spent by all reduces in occupied slots (ms)=4134
      Total time spent by all map tasks (ms)=3962
      Total time spent by all reduce tasks (ms)=4134
      Total vcore-seconds taken by all map tasks=3962
      Total vcore-seconds taken by all reduce tasks=4134
      Total megabyte-seconds taken by all map tasks=4057088
      Total megabyte-seconds taken by all reduce tasks=4233216
      Map-ReduceFramework
      Map input records=21
      Map output records=21
      Map output bytes=84
      Map output materialized bytes=46
      Input split bytes=116
      Combine input records=21
      Combine output records=7
      Reduce input groups=7
      Reduce shuffle bytes=46
      Reduce input records=7
      Reduce output records=7
      SpilledRecords=14
      ShuffledMaps=1
      FailedShuffles=0
      MergedMap outputs=1
      GC time elapsed (ms)=98
      CPU time spent (ms)=2330
      Physical memory (bytes) snapshot=460136448
      Virtual memory (bytes) snapshot=1795633152
      Total committed heap usage (bytes)=355467264
      ShuffleErrors
      BAD_ID=0
      CONNECTION=0
      IO_ERROR=0
      WRONG_LENGTH=0
      WRONG_MAP=0
      WRONG_REDUCE=0
      FileInputFormatCounters
      BytesRead=210
      FileOutputFormatCounters
      BytesWritten=187
      14/12/0600:10:56 INFO client.RMProxy:Connecting to ResourceManager at crxy171.crxy/192.168.1.171:8032
      14/12/0600:10:56 INFO input.FileInputFormat:Total input paths to process :1
      14/12/0600:10:57 INFO mapreduce.JobSubmitter: number of splits:1
      14/12/0600:10:57 INFO mapreduce.JobSubmitter:Submitting tokens for job: job_1417519292729_0031
      14/12/0600:10:57 INFO impl.YarnClientImpl:Submitted application application_1417519292729_0031
      14/12/0600:10:57 INFO mapreduce.Job:The url to track the job: http://crxy171.crxy:8088/proxy/application_1417519292729_0031/
      14/12/0600:10:57 INFO mapreduce.Job:Running job: job_1417519292729_0031
      14/12/0600:11:08 INFO mapreduce.Job:Job job_1417519292729_0031 running in uber mode : false
      14/12/0600:11:08 INFO mapreduce.Job: map 0% reduce 0%
      14/12/0600:11:08 INFO mapreduce.Job:Job job_1417519292729_0031 failed with state FAILED due to:Application application_1417519292729_0031 failed 2 times due to AM Containerfor appattempt_1417519292729_0031_000002 exited with exitCode:1 due to:Exception from container-launch: org.apache.hadoop.util.Shell$ExitCodeException:
      org.apache.hadoop.util.Shell$ExitCodeException:
      at org.apache.hadoop.util.Shell.runCommand(Shell.java:511)
      at org.apache.hadoop.util.Shell.run(Shell.java:424)
      at org.apache.hadoop.util.Shell$ShellCommandExecutor.execute(Shell.java:656)
      at org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor.launchContainer(DefaultContainerExecutor.java:195)
      at org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch.call(ContainerLaunch.java:300)
      at org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch.call(ContainerLaunch.java:81)
      at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:745)
      Container exited with a non-zero exit code 1
      .Failing this attempt..Failing the application.
      14/12/0600:11:08 INFO mapreduce.Job:Counters:0
      java.io.FileNotFoundException:File does not exist:/tmp/1417795832292/preparePreferenceMatrix/numUsers.bin
      at org.apache.hadoop.hdfs.server.namenode.INodeFile.valueOf(INodeFile.java:65)
      at org.apache.hadoop.hdfs.server.namenode.INodeFile.valueOf(INodeFile.java:55)
      at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getBlockLocationsUpdateTimes(FSNamesystem.java:1726)
      at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getBlockLocationsInt(FSNamesystem.java:1669)
      at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getBlockLocations(FSNamesystem.java:1649)
      at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getBlockLocations(FSNamesystem.java:1621)
      at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.getBlockLocations(NameNodeRpcServer.java:482)
      at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.getBlockLocations(ClientNamenodeProtocolServerSideTranslatorPB.java:322)
      at org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java)
      at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:585)
      at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:1026)
      at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1986)
      at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1982)
      at java.security.AccessController.doPrivileged(NativeMethod)
      at javax.security.auth.Subject.doAs(Subject.java:415)
      at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1554)
      at org.apache.hadoop.ipc.Server$Handler.run(Server.java:1980)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(NativeMethod)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
      at org.apache.hadoop.ipc.RemoteException.instantiateException(RemoteException.java:106)
      at org.apache.hadoop.ipc.RemoteException.unwrapRemoteException(RemoteException.java:73)
      at org.apache.hadoop.hdfs.DFSClient.callGetBlockLocations(DFSClient.java:1140)
      at org.apache.hadoop.hdfs.DFSClient.getLocatedBlocks(DFSClient.java:1128)
      at org.apache.hadoop.hdfs.DFSClient.getLocatedBlocks(DFSClient.java:1118)
      at org.apache.hadoop.hdfs.DFSInputStream.fetchLocatedBlocksAndGetLastBlockLength(DFSInputStream.java:264)
      at org.apache.hadoop.hdfs.DFSInputStream.openInfo(DFSInputStream.java:231)
      at org.apache.hadoop.hdfs.DFSInputStream.<init>(DFSInputStream.java:224)
      at org.apache.hadoop.hdfs.DFSClient.open(DFSClient.java:1291)
      at org.apache.hadoop.hdfs.DistributedFileSystem$3.doCall(DistributedFileSystem.java:300)
      at org.apache.hadoop.hdfs.DistributedFileSystem$3.doCall(DistributedFileSystem.java:296)
      at org.apache.hadoop.fs.FileSystemLinkResolver.resolve(FileSystemLinkResolver.java:81)
      at org.apache.hadoop.hdfs.DistributedFileSystem.open(DistributedFileSystem.java:296)
      at org.apache.hadoop.fs.FileSystem.open(FileSystem.java:764)
      at org.apache.mahout.common.HadoopUtil.readInt(HadoopUtil.java:339)
      at org.apache.mahout.cf.taste.hadoop.item.RecommenderJob.run(RecommenderJob.java:172)
      at org.conan.mymahout.recommendation.ItemCFHadoop.toRunByClient(UnknownSource)
      at cmd.client.app.ClientAPP.main(UnknownSource)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.apache.hadoop.util.RunJar.main(RunJar.java:212)
      Caused by: org.apache.hadoop.ipc.RemoteException(java.io.FileNotFoundException):File does not exist:/tmp/1417795832292/preparePreferenceMatrix/numUsers.bin
      at org.apache.hadoop.hdfs.server.namenode.INodeFile.valueOf(INodeFile.java:65)
      at org.apache.hadoop.hdfs.server.namenode.INodeFile.valueOf(INodeFile.java:55)
      at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getBlockLocationsUpdateTimes(FSNamesystem.java:1726)
      at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getBlockLocationsInt(FSNamesystem.java:1669)
      at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getBlockLocations(FSNamesystem.java:1649)
      at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getBlockLocations(FSNamesystem.java:1621)
      at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.getBlockLocations(NameNodeRpcServer.java:482)
      at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.getBlockLocations(ClientNamenodeProtocolServerSideTranslatorPB.java:322)
      at org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java)
      at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:585)
      at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:1026)
      at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1986)
      at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:1982)
      at java.security.AccessController.doPrivileged(NativeMethod)
      at javax.security.auth.Subject.doAs(Subject.java:415)
      at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1554)
      at org.apache.hadoop.ipc.Server$Handler.run(Server.java:1980)
      

        

    http://qnalist.com/questions/4884816/how-to-execute-recommenderjob-without-preference-value

    这里有人是这样解决的:数据文件中字段的分割原来是空格,改为逗号。我用的数据文件本来就是逗号。还是报这个错误。

     

     

    解决方法:

    Apache hadoop

    设置方法参考: hadoop2.2+mahout0.9实战 - 推酷 http://www.tuicool.com/articles/ryU7Ff

    cdh

    版本:5.1.3 经验感觉,cdh和Apache的hadoop在使用的时候,同样的技术在使用的时候经常不同。mahout也该用cloudera自己的。

    在centos中安装mahout:sudo yum install mahout

     

    是cloudera官网提供的

     

    vi /etc/hadoop/conf/hadoop-env.sh
    在HADOOP_CLASSPATH后添加:/usr/lib/mahout/*:/usr/lib/mahout/lib/*
     
    现在可以运行了:
    mahout hadoop jar jar.jar  cmd.client.app.ClientAPP

    或者hadoop jar jar.jar  cmd.client.app.ClientAPP都能运行

     
     
     
     
     
     
     
     
     
     
     
     
     
     





  • 相关阅读:
    懒加载
    通过Xib自定义控件
    自定义控件
    swiper_banner图的封装
    uni-app中封装的search和scroll-view
    使用git从创建仓库或项目到push到远程并创建分支常用命令
    随手封装一个简单的日期组件(基于ele-ui的基础上)
    封装的一个时间条插件
    websocket的封装2
    websocket的封装1(做vue中的通信经常也是大概率用到的)
  • 原文地址:https://www.cnblogs.com/xfly/p/4147216.html
Copyright © 2011-2022 走看看