Chef infra Wagrant上的厨师配方不考虑rest\u超时或长时间运行的w-get下载上的超时选项
我正在尝试在厨师食谱中使用一个大文件,它是一个大约350mb的数据库备份。我正在使用wget获取文件,以下是我的配方:Chef infra Wagrant上的厨师配方不考虑rest\u超时或长时间运行的w-get下载上的超时选项,chef-infra,vagrant,chef-recipe,chef-solo,Chef Infra,Vagrant,Chef Recipe,Chef Solo,我正在尝试在厨师食谱中使用一个大文件,它是一个大约350mb的数据库备份。我正在使用wget获取文件,以下是我的配方: include_recipe "apt" include_recipe "sudo" execute "sudo mkdir -p ~/dev/dbbackup" execute "download most recent db backup" do command "sudo wget --user=theusername --password=thepasswor
include_recipe "apt"
include_recipe "sudo"
execute "sudo mkdir -p ~/dev/dbbackup"
execute "download most recent db backup" do
command "sudo wget --user=theusername --password=thepassword -P ~/dev/dbbackup/ https://ourdbbackup.com/latest.psql.gz"
timeout 86400
end
无论我尝试了什么,我都会得到以下结果:
[2013-04-23T21:50:32+00:00] INFO: Processing execute[download most recent database backup] action run (company_dev::default line 25)
bash: line 2: 1184 Killed chef-solo -c /tmp/vagrant-chef-1/solo.rb -j /tmp/vagrant-chef-1/dna.json
Chef never successfully completed! Any errors should be visible in the output above. Please fix your recipes so that they properly complete.
我甚至尝试了monkey patching Vagrant,以便添加rest\u超时选项:
Vagrant::Config.run do |config|
config.vm.box = "precise32"
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "cookbooks"
chef.add_recipe "company_dev"
chef.log_level = :debug
chef.rest_timeout = 86400
end
end
rest_timeout 86400
这将生成一个/tmp/vagrant-chef-1/solo.rb,其中有一个rest\u超时选项:
Vagrant::Config.run do |config|
config.vm.box = "precise32"
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "cookbooks"
chef.add_recipe "company_dev"
chef.log_level = :debug
chef.rest_timeout = 86400
end
end
rest_timeout 86400
但我还是犯了Chef无法完成的错误。在没有厨师超时或其他问题停止菜谱的情况下,有什么建议可以让这个大下载正常工作吗?当我设置机器然后从内部运行wget时,它工作正常。非常感谢任何帮助 在下载文件时生成wget的动态控制台输出中似乎存在问题。这会导致内存不足错误。
我已经通过使用“curl-O filename download\u url”解决了这个问题。增加虚拟机的内存,将以下内容添加到Vagrantfile:
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "2048"]
end
然后重新创建虚拟机:
vagrant destroy --force && vagrant up
PS:为什么不使用wget从外部源下载大文件,而不使用wget来解决同样的问题呢。将命令更改为使用
curl-O#{URL}
,chef客户端运行不再因错误runkill而失败。在rackspace云上使用chef 11.4