簡體   English   中英

java.net.ConnectException:使用Shell命令時Hadoop中的連接被拒絕

[英]java.net.ConnectException: Connection refused in Hadoop while using shell commands

我已經安裝了7個運行Ubuntu服務器14.04 LTS的VM實例。 instance-1(主機名)運行namenode和其他幾個服務,而所有其他實例運行datanode服務。 我想在一個datanode的hdfs根目錄上創建一個目錄,但出現此錯誤

root@instance-2:~# hdfs dfs -mkdir hdfs://localhost/user/
mkdir: Call From instance-2/10.240.17.255 to localhost:8020 failed on
connection exception: java.net.ConnectException: Connection refused; For 
more details see:  http://wiki.apache.org/hadoop/ConnectionRefused
root@instance-2:~# hdfs dfs -mkdir hdfs://instance-2/user/
mkdir: Call From instance-2/10.240.17.255 to instance-2:8020 failed on
connection exception: java.net.ConnectException: Connection refused; For 
more details see:  http://wiki.apache.org/hadoop/ConnectionRefused

這是我在實例2上的jps輸出

root@instance-2:~# jps
2267 NodeManager
5012 Jps
2274 DataNode

這是我在實例1上的jps輸出

root@instance-1:~# jps
9043 Jps
1490 Main
3011 RunJar
3227 ResourceManager
4736 HeadlampServer
2409 SecondaryNameNode
3095 JobHistoryServer
2411 QuorumPeerMain
2734 AlertPublisher
2423 RunJar
2562 Bootstrap
5059 Main
2430 Bootstrap
5174 EventCatcherService
5060 Main
2487 NameNode

我仍然嘗試從執行個體1建立目錄,但仍收到相同的錯誤

root@instance-1:~# hdfs dfs -mkdir hdfs://instance-2/user/
mkdir: Call From instance-1/10.240.71.132 to instance-2:8020 failed on 
connection exception: java.net.ConnectException: Connection refused; For 
more details see:  http://wiki.apache.org/hadoop/ConnectionRefused

這是我的instance-1的主機文件

root@instance-1:~# cat /etc/hosts
127.0.0.1 localhost
10.240.71.132 instance-1
10.240.17.255 instance-2
10.240.50.197 instance-3
10.240.61.121 instance-4
10.240.98.215 instance-5
10.240.72.7 instance-6
10.240.216.72 instance-7
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
169.254.169.254 metadata.google.internal metadata

這是我的instance-2主機文件

root@instance-2:~# cat /etc/hosts
127.0.0.1 localhost
10.240.71.132 instance-1
10.240.17.255 instance-2
10.240.50.197 instance-3
10.240.61.121 instance-4
10.240.98.215 instance-5
10.240.72.7 instance-6
10.240.216.72 instance-7
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
169.254.169.254 metadata.google.internal metadata

這是telnet命令輸出

root@instance-2:~# telnet localhost 8020
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused

root@instance-2:~# telnet instance-2 8020
Trying 10.240.17.255...
telnet: Unable to connect to remote host: Connection refused

實例1上的netstat命令顯示端口8020上沒有任何運行

root@instance-1:~# netstat -tulpn | grep 8020
root@instance-1:~# netstat -tulpn | grep 8020
root@instance-1:~# netstat -tulpn | grep 8020

希望此信息可以幫助您調查問題。 提前致謝。

嘗試為您的Ubuntu VM禁用防火牆。 此鏈接將有助於禁用防火牆 否則,您還可以向防火牆添加例外

基於雲提供商,您可以打開虛擬機的端口。 如果使用的是AMS EC2 ,請在安全組中為VM打開所需的端口號。如果使用的是Microsoft Azure,則添加所需的終結點。

添加異常后,請從namenode重新啟動hadoop服務。 希望一切正常。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM