[英]Puppet facter slow for some network facts
I'm learning about vagrant and puppet . 我正在学习流浪汉和木偶 。 When I use the vagrant lucid32 (Ubuntu 10.04), puppet seems very slow.
当我使用无业游民的lucid32(Ubuntu 10.04)时,木偶看起来非常慢。 I've fixed the fqdn problem (question 7780322) but it's still very slow.
我已经解决了fqdn问题(问题7780322),但是它仍然很慢。
I've traced (part of) the problem to facter. 我已将问题的一部分找到了。 Asking for ipaddress is very quick, but ipaddress_eth0 takes 20 seconds:
询问ipaddress很快,但是ipaddress_eth0需要20秒:
root@a:/# time facter ipaddress
10.0.2.15
real 0m0.031s
user 0m0.024s
sys 0m0.004s
root@a:/# time facter ipaddress_eth0
10.0.2.15
real 0m20.126s
user 0m0.080s
sys 0m0.020s
root@a:/#
Looking for ipaddress_lo is also slow. 寻找ipaddress_lo也很慢。
Can anyone help me with a solution or a suggestion for how to debug this? 谁能帮助我解决问题或提出调试建议? I'm new to Ruby, but willing to learn.
我是Ruby的新手,但愿意学习。
Thanks. 谢谢。
I just defined the unknown hosts(?) in /etc/hosts: 我刚刚在/ etc / hosts中定义了未知主机(?):
10.0.2.3 computer1 10.0.2.2 computer2
After this, the arp -a was very quick and hence improved the response of facter -p in-turn improved the performance of puppet agent --test 此后,arp -a非常快,因此改善了事实-p的响应,进而提高了人偶代理--test的性能
Problem was that arp -a
runs very slowly. 问题是
arp -a
运行非常缓慢。
vagrant@lucid32:~$ time arp -a
? (10.0.2.3) at 52:54:00:12:35:03 [ether] on eth0
? (10.0.2.2) at 52:54:00:12:35:02 [ether] on eth0
real 0m20.022s
user 0m0.004s
sys 0m0.000s
vagrant@lucid32:~$
I assume that this is a problem with some combination of virtualbox (4.1.12_77245), host-only networking, ubuntu 10.04, and windows 7 host OS. 我假设这是virtualbox(4.1.12_77245),仅主机网络,ubuntu 10.04和Windows 7主机OS的某种组合的问题。
As a workaround, assuming that I can learn a bit about puppet without it knowing my mac addresses, I replaced line 7 of /opt/ruby/lib/ruby/gems/1.8/gems/facter-1.6.0/lib/facter/arp.rb
as follows: 作为一种解决方法,假设我可以在不了解我的mac地址的情况下学习一些关于puppet的知识,我替换了
/opt/ruby/lib/ruby/gems/1.8/gems/facter-1.6.0/lib/facter/arp.rb
如下:
require 'facter/util/ip'
Facter.add(:arp) do
confine :kernel => :linux
setcode do
### output = Facter::Util::Resolution.exec('arp -a') # disable for slow arp
output = "" ### return a blank, rather than the real (but slow) arp
if not output.nil?
arp = ""
output.each_line do |s|
if s =~ /^\S+\s\S+\s\S+\s(\S+)\s\S+\s\S+\s\S+$/
arp = $1.downcase
break # stops on the first match
end
end
end
"fe:ff:ff:ff:ff:ff" == arp ? arp : nil
end
end
Facter::Util::IP.get_interfaces.each do |interface|
Facter.add("arp_" + Facter::Util::IP.alphafy(interface)) do
confine :kernel => :linux
setcode do
arp = Facter::Util::IP.get_arp_value(interface)
"fe:ff:ff:ff:ff:ff" == arp ? arp : nil
end
end
end
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.