Puppet自動化分布式環境對時間要求非常嚴格,日常正常工作中很容易出現如下報錯:
1
2
3
4
<code>Triggering </code><code>test</code><code>.cn7788.com</code>
<code>Host </code><code>test</code><code>.cn7788.com failed: certificate verify failed. This is often because the </code><code>time</code> <code>is out of </code><code>sync</code> <code>on the server or client</code>
<code>test</code><code>.cn7788.com finished with </code><code>exit</code> <code>code 2</code>
<code>Failed: </code><code>test</code><code>.cn7788.com</code>
大家可以關注“This is often because the time is out of sync on the server or client”此行報錯,一般來說,如果出現類似字樣,基本都是由于時間不精準而引起的問題,大家用ntpdate自動對時即可解決。
工作中新增加了多組Xen虛拟機器也要求用Puppet伺服器來進行自動化管理(初始化環境已經采用Xen的模闆機來處理了),環境如下所示:
<code>192.168.11.26 test1.cn7788.com puppet-client</code>
<code>192.168.11.27 test2.cn7788.com puppet-client</code>
<code>192.168.11.28 test3.cn7788.com puppet-client</code>
發現一樣出現了如上報錯,原因如下:
Xen虛拟機器同主控端硬體時鐘同步,本來是很友善的嘛。不過因為軟體模拟中斷會在負載變化的時候出現延遲,是以會逐漸會比正常時間變慢,我們修改下xen虛拟機的核心檔案/etc/sysctl.conf,添加代碼如下:
<code>xen.independent_wallclock = 1</code>
然後用如下指令使核心改動迅速生效,如下:
<code>sysctl -p</code>
最後我們在這三台Xen機器上用ntpdate指令來同步時間,確定Xen虛拟機器不會因為時間問題報錯,指令如下所示:
<code>ntpdate ntp.api.bz</code>
本文轉自 撫琴煮酒 51CTO部落格,原文連結:http://blog.51cto.com/yuhongchun/1301516,如需轉載請自行聯系原作者