WARN org.apache.hadoop.hdfs.server.datanode.DataNode: Problem connecting to server:

关防火墙之类的并不能解决问题,仔细思考了下,我决定先用telnet远程访问端口,成功后发现还是不能把datanode连上namenode,于是我把本地的23端口(telnet需要)也开放了,确保能本地访问。

先装个telnet,生成iptables相关规则(别没事就关防火墙)

hosts文件别出现0,0,0,0的ip(slave节点上)

yum install telnet -y
yum install telnet-server -y
yum install iptables-services -y
yum -y install xinetd

在iptables文件中开放23端口,新安装的Linux系统中,防火墙默认是被禁掉的,没有配置过任何防火墙的策略,所有不存在/etc/sysconfig/iptables文件。

systemctl stop firewalld
systemctl mask firewalld  
systemctl enable iptables
systemctl stop iptables
systemctl start iptables
systemctl restart iptables
service iptables save
vim /etc/sysconfig/iptables
# Generated by iptables-save v1.4.21 on Fri Jun 22 21:17:57 2018
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [68:9482]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 23 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
# Completed on Fri Jun 22 21:17:57 2018

允许root账户登录

vi /etc/securetty
#结尾加上
pts/0  
pts/1 

重启iptables服务

systemctl restart iptables
systemctl disable firewalld
systemctl stop firewalld
systemctl start telnet.socket
systemctl start xinetd
systemctl enable xinetd
systemctl enable telnet.socket

最后验证一下:

telnet localhost 23

telnet  ip port(namenode)

对了,由于需要远程访问,所以我把master的host文件改了下

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
0.0.0.0    spark-master

这么做是为了让远程访问可行,netstat -nltp查看,你的9000端口需要是

0.0.0.0 9000

这样所有的主机都能远程连接



你可能感兴趣的:(WARN org.apache.hadoop.hdfs.server.datanode.DataNode: Problem connecting to server:)