运行
hadoop fs -ls
时出现错误如下:
root@ubuntu:/home/chenwq/hadoop/book/ch03/src/main/java# hadoop fs -ls 11/08/31 22:51:37 INFO security.Groups: Group mapping impl=org.apache.hadoop.security.ShellBasedUnixGroupsMapping; cacheTimeout=300000 11/08/31 22:51:38 WARN conf.Configuration: mapred.task.id is deprecated. Instead, use mapreduce.task.attempt.id 11/08/31 22:51:39 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:8020. Already tried 0 time(s). 11/08/31 22:51:40 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:8020. Already tried 1 time(s). 11/08/31 22:51:41 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:8020. Already tried 2 time(s). 11/08/31 22:51:42 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:8020. Already tried 3 time(s). 11/08/31 22:51:43 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:8020. Already tried 4 time(s). 11/08/31 22:51:44 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:8020. Already tried 5 time(s). 11/08/31 22:51:45 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:8020. Already tried 6 time(s). 11/08/31 22:51:46 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:8020. Already tried 7 time(s). 11/08/31 22:51:47 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:8020. Already tried 8 time(s). 11/08/31 22:51:48 INFO ipc.Client: Retrying connect to server: localhost/127.0.0.1:8020. Already tried 9 time(s). Bad connection to FS. command aborted.
解决方案:
格式化namenode:
hadoop namenode -format
重新启动start-all.sh,输入
jps
查看后台进程
root@ubuntu:/home/chenwq/hadoop/hadoop-0.21.0/bin# jps 8734 NameNode 8934 DataNode 9137 SecondaryNameNode 9479 Jps
此时namenode启动
运行
hadoop fs -ls
出现:
11/08/31 23:09:37 INFO security.Groups: Group mapping impl=org.apache.hadoop.security.ShellBasedUnixGroupsMapping; cacheTimeout=300000 11/08/31 23:09:37 WARN conf.Configuration: mapred.task.id is deprecated. Instead, use mapreduce.task.attempt.id Found 1 items -rw-r--r-- 1 root supergroup 628 2011-08-31 23:01 /user/root/books/URLCat.java