如何在Google Computer Engine上创建的两个实例之间ssh-copy id

时间:2018-07-30 17:28:12

标签: google-cloud-platform google-compute-engine hortonworks-data-platform hortonworks-sandbox

实例:1 主机名:hdp-node-1 ip地址:35.200.132.198

实例:2 主机名:hdp-node-2 ip地址:35.200.208.150

我可以从本地计算机登录两个实例。但是我想在谷歌云平台的这两个实例之间使用公共私钥对设置无密码的SSH,我已经在节点1上创建了RSA密钥,但是当我尝试ssh-copy-id时,它给出的权限被拒绝了我也还检查了文件夹权限。

>>> 'C' in [x for i in my_dict.values() for x in i]
True

调试日志

hdpuser@hdp-node-1:~$ ssh-copy-id -i ~/.ssh/id_rsa.pub hdpuser@35.200.208.150

/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: 
"/home/hdpuser/.ssh/id_rsa.pub"
The authenticity of host '35.200.208.150 (35.200.208.150)' can't be 
established.
ECDSA key fingerprint is SHA256:ATVf5KnwDP1DX0+m/LnByw6aMQg8wsdFW9i2OPooDEE.
Are you sure you want to continue connecting (yes/no)? yes
/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: INFO: 1 key(s) remain to be installed -- if you are 
prompted now it is to install the new keys
hdpuser@35.200.208.150: Permission denied (publickey).

我已经转介了这篇文章,但我不知道该怎么办

how to ssh between two instances created on Google Computer Engine?

我需要在此处设置HDP,在此先谢谢

1 个答案:

答案 0 :(得分:1)

如果安装由平台管理的project wide keysinstance only公钥,则更加容易。安装在每个实例上的GCE代理将为您复制元数据中的实例。即使您动态创建新节点,该解决方案也将起作用。