eclipse配置hadoop的错误

时间:2023-03-08 22:06:37

配置好eclipse,在执行run on hadoop的时候,提示
11/03/29 16:47:59 WARN conf.Configuration: DEPRECATED: hadoop-site.xml found in the classpath. Usage of hadoop-site.xml is deprecated. Instead use core-site.xml, mapred-site.xml and hdfs-site.xml to override properties of core-default.xml, mapred-default.xml and hdfs-default.xml respectively
11/03/29 16:48:01 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:9000. Already tried 0 time(s).
11/03/29 16:48:02 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:9000. Already tried 1 time(s).
11/03/29 16:48:03 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:9000. Already tried 2 time(s).
11/03/29 16:48:04 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:9000. Already tried 3 time(s).
11/03/29 16:48:05 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:9000. Already tried 4 time(s).
11/03/29 16:48:06 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:9000. Already tried 5 time(s).
11/03/29 16:48:07 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:9000. Already tried 6 time(s).
11/03/29 16:48:08 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:9000. Already tried 7 time(s).
11/03/29 16:48:09 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:9000. Already tried 8 time(s).
11/03/29 16:48:10 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:9000. Already tried 9 time(s).
Exception in thread "main" java.net.ConnectException: Call to localhost/127.0.0.1:9000 failed on connection exception: java.net.ConnectException: Connection refused
补充:1. eclipse已经链接上hdfs,文件夹也上传至hdfs中
            2. hdfs的安全模式也已经取消,hadoop dfsadmin -safemode leave
            3. 在运行配置的时候,名称用的也不是localhost(localhost连接不上hdfs),用的是机器名称
            4.hadoop已经配置好,wordcount程序在命令行里能成功运行,我的hadoop的是完全分布模式,1个namenode,4个datanode

问题终于解决了!困扰我好久的问题啊!解决方法:
将eclipse运行配置中的arguments中 hdfs://localhost:9000/user/lxz/testin hdfs://localhost:9000/user/lxz/testout
改为:
hdfs://lxz-pc:9000/user/lxz/testin hdfs://lxz-pc:9000/user/lxz/testout
即:把localhost改为你的namenode的机器名,改为ip不行,我试过
希望能帮助到和我遇到了同样问题的朋友!

mac主机名在 系统偏好设置->共享中设置:XXX.local

在终端上可以用 uname -n或hostname -f的方式来查看

Arguments配置:

hdfs://ruancc.local:9000/Users/mac/wordcount.txt hdfs://ruancc.local:9000/Users/mac/output

ToolRunner与eclipse hadoop 插件的替代品,简化M/R程序的开发

http://my.oschina.net/Senger/blog/77943