1

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

请帮帮我

4

1 回答 1

2

检查您如何在厨师配置文件中配置chef_server_url

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

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

chef_server_url '我的服务器:8080'

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

chef_server_url 'myserver.mycompany.com:8080'

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

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

于 2013-09-25T10:39:03.023 回答