localhost: ssh: connect to host

2019-08-16  本文已影响0人  蕴重Liu

搭建单机伪分布式模式
启动hadoop时,报错22端口无法连接

root@503ae25fe58d:/usr/local/src/hadoop/sbin# ./start-dfs.sh
Starting namenodes on [localhost]
localhost: ssh: connect to host localhost port 22: Cannot assign requested address
localhost: ssh: connect to host localhost port 22: Cannot assign requested address
Starting secondary namenodes [0.0.0.0]
0.0.0.0: ssh: connect to host 0.0.0.0 port 22: Connection refused
root@503ae25fe58d:/usr/local/src/hadoop/sbin# jps
786 Jps
  1. 首先检查ssh服务是否已启动
root@503ae25fe58d:/usr/local/src/hadoop/sbin# service ssh status
 * sshd is not running
root@503ae25fe58d:/usr/local/src/hadoop/sbin# service ssh start
 * Starting OpenBSD Secure Shell server sshd 
root@503ae25fe58d:/usr/local/src/hadoop/sbin# ./start-dfs.sh
Starting namenodes on [localhost]
root@localhost's password: 
localhost: Permission denied, please try again.
root@localhost's password: 
  1. 设置本机免密登录
root@503ae25fe58d:/usr/local/src/hadoop/sbin# ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
Generating public/private rsa key pair.
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:HJEBdcUPUi3DDh49lyZ4vj0gxy6/Gkf8/mfpaGq5I54 root@503ae25fe58d
The key's randomart image is:
+---[RSA 2048]----+
|      .o+o.Bo. . |
|        .o= @ =  |
|        .. O X   |
|       . .o.* .  |
|        S  +o+   |
|          ..o.o  |
|          .oo ...|
|         ..*.o..o|
|        .E++*oo+o|
+----[SHA256]-----+
root@503ae25fe58d:/usr/local/src/hadoop/sbin# cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
root@503ae25fe58d:/usr/local/src/hadoop/sbin# chmod 0600 ~/.ssh/authorized_keys
root@503ae25fe58d:/usr/local/src/hadoop/sbin# ssh localhost
Welcome to Ubuntu 18.04.2 LTS (GNU/Linux 4.15.0-54-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

This system has been minimized by removing packages and content that are
not required on a system that users do not log into.

To restore this content, you can run the 'unminimize' command.
Last login: Fri Aug 16 12:28:50 2019 from 172.17.0.1
root@503ae25fe58d:~# 
上一篇下一篇

猜你喜欢

热点阅读