hadoop fs -ls:从服务器/127.0.1.1到本地主机的调用失败

时间:2018-08-13 14:03:19

标签: hadoop hdfs

我以伪分布式模式安装了hadoop

运行命令时

hadoop fs -ls

我遇到以下错误:

ls: Call From kali/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

有什么建议吗?

1 个答案:

答案 0 :(得分:0)

If you read the link in the error, I see two immediate points that need addressed.

If the error message says the remote service is on "127.0.0.1" or "localhost" that means the configuration file is telling the client that the service is on the local server. If your client is trying to talk to a remote system, then your configuration is broken.

You should treat pseudodistributed mode as a remote system, even if it is only running locally.

For HDFS, you can resolve that by putting your computer hostname (preferably the full FQDN for your domain), as the HDFS address in core-site.xml. For your case, hdfs://kali:9000 should be enough

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).

I'm not completely sure why it needs removed, but the general answer I can think of is that Hadoop is a distributed system, and as I mentioned, treat the pseudodistributed mode as if it's remote HDFS server. Therefore, no loopback addresses should use your computers hostname

For example, remove the second line of this

127.0.0.1 localhost
127.0.1.1 kali

Or remove the hostname from this

127.0.0.1 localhost kali

Most importantly (emphasis added)

None of these are Hadoop problems, they are hadoop, host, network and firewall configuration issues