Knife ec2:需要避免在主机名更改后重新启动服务器
Knife ec2: need to avoid re-boostraping of server after hostname change
我可能做错了什么,但情况就是这样。独立 Chef 服务器 12.3.0。 AWS 上的 CentOS 6.3 运行ning。
在执行 knife bootstrap
期间,我正在应用 hostname:default 配方来更改服务器的 FQDN 以及其他一些配方。一切似乎都很好。 Chef 服务器显示新的 boostrapped 实例,但是 Node Name 列仍然显示旧的 FQDN,smth like ip-x-x-x-x.aws-region-name.compute.internal.
然后我尝试 ssh 这个主机,运行 chef-client
我收到以下错误:
[ec2-user@newHostName ~]$ sudo chef-client
Starting Chef Client, version 12.3.0
Chef encountered an error attempting to load the node data for "newHostName"
Authentication Error:
----------------
Failed to authenticate to the chef server (http 401).
Server Response:
----------------
Failed to authenticate as 'newHostName'. Ensure that your node_name and client key are correct.
Relevant Config Settings:
-------------------------
chef_server_url "https://chefServerDomain/organizations/organizationName"
node_name "newHostName"
client_key "/etc/chef/client.pem"
If these settings are correct, your client_key may be invalid, or
you may have a chef user with the same client name as this node.
[2015-05-04T12:36:03-07:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 0 resources updated in 0.962848623 seconds
[2015-05-04T12:36:03-07:00] ERROR: 401 "Unauthorized"
[2015-05-04T12:36:03-07:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
我已经检查了 GitHub 上的已关闭问题 #8,据此我需要手动更改 client.rb 文件并包含 node_name参数。同时 Chef client.rb 文档指出我不应该那样做 :
node_name is used to determine which configuration should be applied
and to set the client_name (which is the name used when
authenticating to a Chef server). The default value is set
automatically to be the FQDN of the chef-client, as detected by
Ohai. In general, leaving this setting blank and letting Ohai
assign the FQDN of the node as the node_name during each chef-client
run is the recommended approach.
清理 /etc/chef/* 文件夹后,从 Chef 服务器中删除此实例并再次重新引导 EC2 实例,我能够使其正常工作。 FQDN 在 Chef 服务器的 Node Name 列下正确显示为 newServerName。
请教一下,我应该怎么做才能避免双引导?
将您希望节点使用的节点名称与“-N 主机名”一起传递给 bootstrap 命令。然后它将使用最终节点名称正确注册。
我可能做错了什么,但情况就是这样。独立 Chef 服务器 12.3.0。 AWS 上的 CentOS 6.3 运行ning。
在执行 knife bootstrap
期间,我正在应用 hostname:default 配方来更改服务器的 FQDN 以及其他一些配方。一切似乎都很好。 Chef 服务器显示新的 boostrapped 实例,但是 Node Name 列仍然显示旧的 FQDN,smth like ip-x-x-x-x.aws-region-name.compute.internal.
然后我尝试 ssh 这个主机,运行 chef-client
我收到以下错误:
[ec2-user@newHostName ~]$ sudo chef-client
Starting Chef Client, version 12.3.0
Chef encountered an error attempting to load the node data for "newHostName"
Authentication Error:
----------------
Failed to authenticate to the chef server (http 401).
Server Response:
----------------
Failed to authenticate as 'newHostName'. Ensure that your node_name and client key are correct.
Relevant Config Settings:
-------------------------
chef_server_url "https://chefServerDomain/organizations/organizationName"
node_name "newHostName"
client_key "/etc/chef/client.pem"
If these settings are correct, your client_key may be invalid, or
you may have a chef user with the same client name as this node.
[2015-05-04T12:36:03-07:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 0 resources updated in 0.962848623 seconds
[2015-05-04T12:36:03-07:00] ERROR: 401 "Unauthorized"
[2015-05-04T12:36:03-07:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
我已经检查了 GitHub 上的已关闭问题 #8,据此我需要手动更改 client.rb 文件并包含 node_name参数。同时 Chef client.rb 文档指出我不应该那样做 :
node_name is used to determine which configuration should be applied and to set the client_name (which is the name used when authenticating to a Chef server). The default value is set automatically to be the FQDN of the chef-client, as detected by Ohai. In general, leaving this setting blank and letting Ohai assign the FQDN of the node as the node_name during each chef-client run is the recommended approach.
清理 /etc/chef/* 文件夹后,从 Chef 服务器中删除此实例并再次重新引导 EC2 实例,我能够使其正常工作。 FQDN 在 Chef 服务器的 Node Name 列下正确显示为 newServerName。
请教一下,我应该怎么做才能避免双引导?
将您希望节点使用的节点名称与“-N 主机名”一起传递给 bootstrap 命令。然后它将使用最终节点名称正确注册。