解决:使用ssh-copy-id命令时出现ERROR: ssh: Could not resolve hostname hadoop01:Name or service not known
Posted 爱编码阿信
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解决:使用ssh-copy-id命令时出现ERROR: ssh: Could not resolve hostname hadoop01:Name or service not known相关的知识,希望对你有一定的参考价值。
1、问题描述
搭建rocketmq集群时,使用ssh-copy-id命令拷贝密钥到其他机器,如hadoop01,hadoop02,出现如下错误信息
[root@hadoop03 .ssh]# ssh-copy-id hadoop02
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed/usr/bin/ssh-copy-id: ERROR: ssh: Could not resolve hostname hadoop02: Name or service not known
[root@hadoop03 .ssh]# ssh-copy-id hadoop01
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed/usr/bin/ssh-copy-id: ERROR: ssh: Could not resolve hostname hadoop01: Name or service not known
如图:
2、切换root账户执行
su root命令
3、编辑/etc/hosts文件,执行如下命令
vi /etc/hosts
在文件末尾添加以下配置
wq!保存并退出
4、再次执行命令
ssh-copy-id hadoop02
输出信息如下
错误解决
以上是关于解决:使用ssh-copy-id命令时出现ERROR: ssh: Could not resolve hostname hadoop01:Name or service not known的主要内容,如果未能解决你的问题,请参考以下文章
使用 shell gitlab-runner ERRO [0000] 时出现 docker 错误
使用 Spring + Thymeleaf 时出现 java.lang.***Error
使用sar命令时出现Please check if data collecting is enabled的解决方法
执行Git命令时出现各种 SSL certificate problem 的解决办法