将Mahout指向HDFS而不是本地磁盘

时间:2014-06-19 20:00:00

标签: hadoop hdfs mahout

我正在尝试使用HDFS中的文件对Mahout进行逻辑回归 - 该文件的名称为ppeng.txt,并带有以下命令行。

  

mahout org.apache.mahout.classifier.sgd.TrainLogistic - 通过5   --rate 1 --lambda 0.5 --input ppeng.txt --features 21 --output test_mahout --target nbr_of_txns --categories 2 --predictors   lifetime_rev_usd_amt ntpv_12_mth_sent_usd_amt --types n n

此文件位于HDFS中,但是,除非我将文件复制到本地计算机,否则此行会出现“找不到文件”异常。

我的HADOOP_LOCAL变量也设置为null。我得到的错误如下 - 有任何人有修复此问题的经验 - 如果有,请帮助。

Exception in thread "main" java.io.FileNotFoundException: ppeng.txt (No such file or directory)**
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:120)
        at org.apache.mahout.classifier.sgd.TrainLogistic.open(TrainLogistic.java:316)
        at org.apache.mahout.classifier.sgd.TrainLogistic.mainToOutput(TrainLogistic.java:75)
        at org.apache.mahout.classifier.sgd.TrainLogistic.main(TrainLogistic.java:64)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.hadoop.util.ProgramDriver$ProgramDescription.invoke(ProgramDriver.java:68)
        at org.apache.hadoop.util.ProgramDriver.driver(ProgramDriver.java:139)
        at org.apache.mahout.driver.MahoutDriver.main(MahoutDriver.java:188)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:197)

1 个答案:

答案 0 :(得分:0)

它使用java.io.FileInputStream.open访问本地文件系统。

你能跑吗

hadoop fs -ls

你从哪里开办Mahout工作?如果是这样,您需要取消设置MAHOUT_LOCAL并重试。 Mahout在您启动的计算机上使用Hadoop设置来确定HDFS和mapreduce作业跟踪器的位置。

这是一篇关于在一台机器上切换客户端,本地伪群集和完整群集成员资格的帖子。它还为Mahout设置了正确的旗帜。只是一些bash函数。

http://occamsmachete.com/ml/2012/07/02/how-to-switch-hadoop-confugurations/