首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 服务器 > 云计算 >

Expected authority at index 七: hdfs://

2013-09-28 
Expected authority at index 7: hdfs://hadoop版本:1.0.4今天在跑TestForest的时候,居然出现了这个问题:p

Expected authority at index 7: hdfs://

hadoop版本:1.0.4

今天在跑TestForest的时候,居然出现了这个问题:

package mahout.fansy.partial.test;import org.apache.hadoop.conf.Configuration;import org.apache.mahout.classifier.df.mapreduce.TestForest;public class TestTestForest {/** * 测试TestForest * @param args * @throws Exception  */public static void main(String[] args) throws Exception {String[] arg=new String[]{"-i","hdfs://ubuntu:9000/user/breiman/input/glass.data","-ds","hdfs://ubuntu:9000/user/breiman/glass.info","-m","hdfs://ubuntu:9000/user/breiman/glass.tree/forest.seq","-a","-mr","-o","hdfs://ubuntu:9000/user/breiman/out-testforest0"};Configuration conf=new Configuration();conf.set("mapred.job.tracker", "ubuntu:9001");conf.set("fs.default.name", "hdfs://");TestForest tf=new TestForest();tf.setConf(conf);Configuration confq=tf.getConf();System.out.println(confq);tf.run(arg);}}
刚开始的时候是直接使用TestForest.main(arg)来调用的,但是发现conf的值设置不了(即全部都是按照默认,这个肯定不行,在win7 的myeclipse上面调用hadoop肯定要设置conf的)但是哪里可以设置,所以就想到了TestForest是继承Configuration的,然后Configuration有一个setConf的方法,所以就实例化了一个TestForest对象,然后调用setConf方法设置conf,但是conf设置的不对,所以出现了上面的错误。要如何设置呢?其实把conf.set("fs.default.name", "hdfs://");改为conf.set("fs.default.name", "ubuntu:9000");就可以了,其中ubuntu是主节点机器名。然后就可以跑了。

分享,成长,快乐

转载请注明blog地址:http://blog.csdn.net/fansy1990


热点排行