hadoop fs -ls does not work

2019-09-11 04:22发布

问题:

I have installed a single node Hadoop on my local computer with Ubuntu 14.04 OS. Now I am going to use HDFS, and when I type a simple command

hdu@hadoop:~$ hadoop fs -ls

it shows up the following errors:

15/07/10 18:24:52 WARN util.NativeCodeLoader: 
Unable to load native-hadoop library for your platform... 
using builtin-java classes where applicable
ls: Call From hadoop/127.0.1.1 to 
localhost:9000 failed on connection exception: 
java.net.ConnectException: 
Connection refused; For more details see:
http://wiki.apache.org/hadoop/ConnectionRefused

I have no ideas about this error, and I really appreciate if anyone helps me fix the problem :)

回答1:

Did you actually start your namenode service? Formatting the namenode doesn't actually start the namenode service. If your namenode service is running then perhaps you are running into the Ubuntu issue referenced in the link in the error.

From: http://wiki.apache.org/hadoop/ConnectionRefused

Check that there isn't an entry for your hostname mapped to 127.0.0.1 or 127.0.1.1 in /etc/hosts (Ubuntu is notorious for this)



回答2:

You can try these commands!

# su - hadoop
$ cd /opt/hadoop/hadoop
$ bin/hadoop namenode -format

$ bin/start-all.sh