在Hadoop分布式环境配置的实验过程中,将公匙从Master节点传输到 Slave1 节点时,或者ssh Slave1节点时,可能会遇到以下的问题:
ssh: connect to host slave1 port 22: Connection timed out
lost connection
ssh: connect to host slave1 port 22: No route to host
查找相关资料,这个网页上给的解释最全面:
http://www.gossamer-threads.com/lists/openssh/users/35856
First, see if the Linux can SSH to itself. From some other connection or
from the console, run ssh localhost
This will confirm that the sshd is running and accepting connections. If
it fails, you will know that the problem is on the Linux server.
Then make sure that you do not have a firewall that is blocking an
outbound connection on port 22 (normally). This might be a software
firewall running on your Windows PC. Windows XP SP2 has a built-in
firewall feature, but it is not supposed to block outbound connections,
only inbound connections. Others, though, such as those that are part of
Norton, Symantec, MacAfee, etc. security packages, can block outbound. If
you find one of these in place, you should be able to a) open the port in
question, b) authorize the program in question, or c) temporarily turn the
thing off for testing (be sure to turn it back on).
Finally, if the Windows PC has internet access, you could try connecting
via SSH to someone over the internet.
首先,检查系统能够SSH自己,这个用来判断SSHD是否运行,是否接受连接,如果失败,你能够知道问题出在Linux系统自身。
具体方:ssh localhost
然后,确保防火墙没有禁用22端口,尤其是,如果实验环境是Windows系统的电脑,更应该检查。一些系统默认关闭了一些端口,不允许外部连接,如果你发现问题出在这里,打开端口。
具体方法:Ubuntu系统,sudo ufw allow 22
最后,如果电脑联网了,可以尝试使用SSH连接网络上的其他人,以此判断SSH是否能够正常工作。
除此之外,还应该保证主机和IP地址的映射关系正确,因为虚拟机重启后,IP地址可能会发生变化。
具体方法:Ubuntu系统,sudo vim /etc/hosts查看映射关系