欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

ubuntu: ssh: connect to host ubuntu port 22: No route to host

程序员文章站 2024-03-14 09:08:22
...

启动HDFS系统的时候出现:
ubuntu: ssh: connect to host ubuntu port 22: No route to host

这里使用的是HDFS伪分布式系统。
这个ubuntu是我在/etc/hosts中设置的。
保持/etc/hosts

代码如下:

(python2.7) [email protected]:~$ ifconfig
enp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.103  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::40df:4021:d729:d0c4  prefixlen 64  scopeid 0x20<link>
        ether fc:aa:14:d7:92:85  txqueuelen 1000  (Ethernet)
        RX packets 94189  bytes 94171087 (94.1 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 73981  bytes 12407849 (12.4 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 3469  bytes 346035 (346.0 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3469  bytes 346035 (346.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


可以看到ifconfig得到的 是192.168.0.103
所以把/etc/hosts修改为

192.168.0.103 ubuntu

关闭HDFS系统然后重启即可