我在Ubuntu 14.04计算机上托管了一个独立的Chef服务器。使用最新版本按照https://learn.chef.io/install-and-manage-your-own-chef-server/linux/安装服务器。
当我尝试引导节点时,它会安装客户端版本11.x并运行。但是市场上的大多数烹饪书与客户11不兼容并且需要客户端12.x.
因此,我将客户端版本12.x作为参数提供给我的bootstrap命令,该命令将客户端版本12.x安装到节点以进行引导。但是这次我得到了HTTP 503 - 503" Service Unavailable"错误,无法完成引导。
我的工作站(Mac 10.11.1)
$chef --version
Chef Development Kit Version: 0.10.0
chef-client version: 12.5.1
berks version: 4.0.1
kitchen version: 1.4.2
我的服务器(Ubuntu 14.04.2)
$ dpkg --status chef
Package: chef
Status: install ok installed
Priority: extra
Section: misc
Installed-Size: 107919
Maintainer: Chef Software, Inc. <maintainers@chef.io>
Architecture: amd64
Version: 11.18.12-1
Description: The full stack of chef
License: unknown
Vendor: Omnibus <omnibus@getchef.com>
Homepage: https://www.getchef.com
$ dpkg --status chef-server-core
Package: chef-server-core
Status: install ok installed
Priority: extra
Section: misc
Installed-Size: 1190291
Maintainer: Chef Software, Inc.
Architecture: amd64
Version: 12.3.1-1
Replaces: private-chef
Conflicts: private-chef
Description: The full stack of chef-server
License: unknown
Vendor: Omnibus <omnibus@getchef.com>
Homepage: https://www.chef.io
节点(Ubuntu 14.04.2)
$ chef-client -v
Chef: 12.6.0
这是错误:
Connecting to <nodes_ip>
10.97.151.49 -----> Existing Chef installation detected
10.97.151.49 Starting the first Chef Client run...
10.97.151.49 Starting Chef Client, version 12.6.0
10.97.151.49 Creating a new client identity for web_app_ubuntu using the validator key.
10.97.151.49 [2015-12-25T14:50:47+00:00] WARN: Failed to register new client, 4 tries remaining
10.97.151.49 [2015-12-25T14:50:47+00:00] WARN: Response: HTTP 503 - 503 "Service Unavailable"
10.97.151.49 [2015-12-25T14:52:26+00:00] WARN: Failed to register new client, 3 tries remaining
10.97.151.49 [2015-12-25T14:52:26+00:00] WARN: Response: HTTP 503 - 503 "Service Unavailable"
10.97.151.49 [2015-12-25T14:54:15+00:00] WARN: Failed to register new client, 2 tries remaining
10.97.151.49 [2015-12-25T14:54:15+00:00] WARN: Response: HTTP 503 - 503 "Service Unavailable"
10.97.151.49 [2015-12-25T14:56:01+00:00] WARN: Failed to register new client, 1 tries remaining
10.97.151.49 [2015-12-25T14:56:01+00:00] WARN: Response: HTTP 503 - 503 "Service Unavailable"
10.97.151.49 [2015-12-25T14:57:48+00:00] WARN: Failed to register new client, 0 tries remaining
10.97.151.49 [2015-12-25T14:57:48+00:00] WARN: Response: HTTP 503 - 503 "Service Unavailable"
10.97.151.49
10.97.151.49 Running handlers:
10.97.151.49 [2015-12-25T14:59:36+00:00] ERROR: Running exception handlers
10.97.151.49 Running handlers complete
10.97.151.49 [2015-12-25T14:59:36+00:00] ERROR: Exception handlers complete
10.97.151.49 Chef Client failed. 0 resources updated in 10 minutes 38 seconds
10.97.151.49 [2015-12-25T14:59:36+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
10.97.151.49 [2015-12-25T14:59:36+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
10.97.151.49 [2015-12-25T14:59:36+00:00] ERROR: undefined method `closed?' for nil:NilClass
10.97.151.49 [2015-12-25T14:59:36+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
最后是/var/chef/cache/chef-stacktrace.out中的堆栈跟踪
Generated at 2015-12-25 16:02:37 +0000
NoMethodError: undefined method `closed?' for nil:NilClass
/opt/chef/embedded/lib/ruby/2.1.0/net/http/response.rb:325:in `stream_check'
/opt/chef/embedded/lib/ruby/2.1.0/net/http/response.rb:199:in `read_body'
/opt/chef/embedded/lib/ruby/2.1.0/net/http/response.rb:226:in `body'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/formatters/error_inspectors/registration_error_inspector.rb:139:in `rescue in format_rest_error'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/formatters/error_inspectors/registration_error_inspector.rb:137:in `format_rest_error'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/formatters/error_inspectors/registration_error_inspector.rb:108:in `humanize_http_exception'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/formatters/error_inspectors/registration_error_inspector.rb:27:in `add_explanation'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/formatters/error_mapper.rb:32:in `registration_failed'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/formatters/base.rb:114:in `registration_failed'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/event_dispatch/dispatcher.rb:43:in `call'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/event_dispatch/dispatcher.rb:43:in `block in call_subscribers'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/event_dispatch/dispatcher.rb:34:in `each'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/event_dispatch/dispatcher.rb:34:in `call_subscribers'
(eval):2:in `registration_failed'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/client.rb:623:in `rescue in register'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/client.rb:603:in `register'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/client.rb:255:in `run'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/application.rb:261:in `block in fork_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/application.rb:249:in `fork'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/application.rb:249:in `fork_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/application.rb:215:in `block in run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/local_mode.rb:44:in `with_server_connectivity'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/application.rb:203:in `run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/application/client.rb:413:in `block in interval_run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/application/client.rb:403:in `loop'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/application/client.rb:403:in `interval_run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/application/client.rb:393:in `run_application'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/lib/chef/application.rb:58:in `run'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.6.0/bin/chef-client:26:in `<top (required)="">'
/usr/bin/chef-client:54:in `load'
/usr/bin/chef-client:54:in `<main>'
答案 0 :(得分:1)
我终于弄明白了这个问题。 我支持公司代理和我得到的错误&#34; 503:服务不可用&#34;不是来自Chef Server的东西,而是它来自代理服务器:( 无论如何,使用&#34; no_proxy&#34;选项和添加Chef Server的fqdn解决了这个问题。 是的,这仍然没有回答它如何与厨师客户端v11.x一起使用的问题,但我确信这解决了这个问题:)
答案 1 :(得分:0)
您的系统上可能有knife
的旧版本。运行knife --version
进行确认,您应该会看到它将是旧的11.x版本。追踪该副本的来源(which knife
或type -a knife
)并将其删除。这通常意味着从预先存在的Ruby环境(如RVM)中卸载gem。