【问题标题】:unable to upload cookbook from knife to chef-server无法将菜谱从刀上传到厨师服务器
【发布时间】:2013-09-25 18:39:03
【问题描述】:

我在 ubuntu ec2 实例上运行开源厨师服务器。我正在尝试使用刀将食谱从我的工作站上传到厨师服务器,但出现以下错误

/home/jeevan/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/net/http.rb:878:in `initialize': getaddrinfo: Name or service not known (SocketError)
    from /home/jeevan/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/net/http.rb:878:in `open'
    from /home/jeevan/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/net/http.rb:878:in `block in connect'
    from /home/jeevan/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/timeout.rb:66:in `timeout'
    from /home/jeevan/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/net/http.rb:877:in `connect'
    from /home/jeevan/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/net/http.rb:862:in `do_start'
    from /home/jeevan/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/net/http.rb:851:in `start'
    from /home/jeevan/.rvm/gems/ruby-2.0.0-p195/gems/rest-client-1.6.7/lib/restclient/request.rb:172:in `transmit'
    from /home/jeevan/.rvm/gems/ruby-2.0.0-p195/gems/rest-client-1.6.7/lib/restclient/request.rb:64:in `execute'
    from /home/jeevan/.rvm/gems/ruby-2.0.0-p195/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in `execute'
    from /home/jeevan/.rvm/gems/ruby-2.0.0-p195/gems/rest-client-1.6.7/lib/restclient/resource.rb:76:in `put'
    from /home/jeevan/.rvm/gems/ruby-2.0.0-p195/gems/chef-11.6.0/lib/chef/cookbook_uploader.rb:151:in `block in uploader_function_for'
    from /home/jeevan/.rvm/gems/ruby-2.0.0-p195/gems/chef-11.6.0/lib/chef/cookbook_uploader.rb:25:in `call'
    from /home/jeevan/.rvm/gems/ruby-2.0.0-p195/gems/chef-11.6.0/lib/chef/cookbook_uploader.rb:25:in `block (3 levels) in setup_worker_threads'
    from /home/jeevan/.rvm/gems/ruby-2.0.0-p195/gems/chef-11.6.0/lib/chef/cookbook_uploader.rb:24:in `loop'
    from /home/jeevan/.rvm/gems/ruby-2.0.0-p195/gems/chef-11.6.0/lib/chef/cookbook_uploader.rb:24:in `block (2 levels) in setup_worker_threads'

当我在详细模式下运行相同的命令时,我发现我的笔记本电脑上安装的刀、工作站或厨师客户端正在尝试连接到 ubuntu ec2 实例的私有 IP。

如何防止小刀停止连接ubuntu ec2实例的私有ip,连接到服务器的子域/域或弹性ip。

请帮帮我

【问题讨论】:

  • 厨师服务器的 URL 在你的~/.chef/knife.rb 中配置。确保条目 chef_server_url 的值是您的 ec2 实例的 URL。当您在此厨师服务器中注册您的工作站时,就会发生这种情况。

标签: ruby ubuntu amazon-ec2 chef-infra knife


【解决方案1】:

检查您如何在chef configuration file 中配置 chef_server_url

您可能希望将 fqdn 配置到您的服务器,而不仅仅是主机名。

例如,如果您的机器名为 myhserver.mycompany.com,那么如果您配置了(在您的 knife.rb 中)

chef_server_url 'myserver:8080'

那么你的服务器可能会解析到私有ip,如果你配置了

chef_server_url 'myserver.mycompany.com:8080'

然后可能会解析到你的公网IP。这取决于您的 DNS 是如何配置的。

注意:您还可以考虑将 chef_server_url 配置为指向您的 IP(而不是主机名/fqdn)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多