无法将食谱从刀上传到厨师服务器

时间:2013-09-18 10:56:24

标签: ruby ubuntu amazon-ec2 chef knife

我正在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。

请帮助我

1 个答案:

答案 0 :(得分:2)

查看您在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)。