【发布时间】:2015-04-06 12:11:12
【问题描述】:
错误:致命:找到 # 个节点,但没有建立连接所需的属性。尝试使用 --attribute 设置另一个属性以打开连接。
我开始尝试使用 chef knife 命令运行命令时遇到的问题。如您所见,目的是让命令在角色的任何服务器部分上运行。
所以,当我运行命令时,我得到以下信息
knife ssh "role:servers" "touch /home/ubuntu/file.txt"
WARNING: Failed to connect to ip-172-31-8-x.us-west-2.compute.internal -- SocketError: getaddrinfo: nodename nor servname provided, or not known
WARNING: Failed to connect to ip-172-31-94-xb.us-west-2.compute.internal -- SocketError: getaddrinfo: nodename nor servname provided, or not known
WARNING: Failed to connect to ip-172-31-99-x.us-west-2.compute.internal -- SocketError: getaddrinfo: nodename nor servname provided, or not known
当我尝试新属性时
knife ssh "role:web" "touch /home/ubuntu/file.txt" -x ubuntu -a hostname
FATAL: 6 nodes found, but does not have the required attribute to establish the
connection. Try setting another attribute to open the connection using --attribute.
我尝试了不同的属性,但没有运气
knife ssh "role:servers" "touch /home/ubuntu/file.txt" -a ec2.public_hostname
knife ssh "role:servers" "touch /home/ubuntu/file.txt" -a public_hostname
knife ssh "role:servers" "touch /home/ubuntu/testfile.txt" --attribute 54.68.122.109 -i /Users/useraccount/.ssh/mykey.pem -x ubuntu
FATAL: 2 nodes found, but does not have the required attribute to establish the connection. Try setting another attribute to open the connection using --attribute.
显然我错过了什么。
我应该注意,我可以通过 ssh 进入服务器,但不能使用 Chef-clients 在配置时检测到的 ip-172-31-xx.us-west-2.compute.internal,而是使用 AWS Public知识产权。
这会影响我正常运行上面的命令吗?
Chef server 将节点数据列为
FQDN:ip-172-31-xx-xx.us-west-2.compute.internal
IP 地址:172.31.xx.xx
使用 AWS 设置匹配,
私有 DNS:ip-172-31-xx-xx.us-west-2.compute.internal
私有 IP:172.31.xx.xx
但是,AWS 用于 sshing 到实例中的信息是
公共 DNS:ec2-54-200-xx-xxx.us-west-2.compute.amazonaws.com 公共 IP : 54.200.xx.xxx
这是我可以用来正确 ssh 到服务器(非刀)的 AWS 公共 DNS 数据。
如果问题可能是厨师客户端将节点数据提供到厨师服务器的方式,是否可以更正它以便厨师服务器反映节点 aws 公共 IP 数据?
【问题讨论】:
-
在此处查看第二个答案的 cmets:serverfault.com/questions/641951/…
-
如果使用刀创建 ec2 服务器可能会出现这种情况,但是,我使用自动安装选项,其中 chef-client -j /etc/chef/mynodes.json 检测实例设置然后将自身添加到厨师服务器。这就是问题所在。 FQDN 和 IP 地址显示不正确。我认为他们应该向公共 DNS 名称和 IP 地址显示。因此,如果是这种情况,很想知道 chef-clinet 如何添加此信息。看chef-clinet,看不到如何传入公共信息。
标签: amazon-web-services amazon-ec2 chef-infra knife