天天看點

使用指令生成puppet.conf無法啟動puppet master問題解決

最近對puppet比較感興趣,然後就在虛拟機上裝了puppet。一台當server,一台當agent。因為預設的puppet預設配置檔案隻有main和agent兩個選項,并沒有master。是以我使用了指令puppet –genmaster > /etc/puppet/puppet.conf,之後使用init.d下的腳本啟動puppet master就起不來了。。。具體如下:

一、 環境:

1. 系統: CentOS 6.5

2. puppet版本:puppet-server-2.7.26-2.el6.noarch puppet-2.7.26-2.el6.noarch

二、問題現象:

使用/etc/init.d/puppetmasterd start啟動時,在指令行會出現如下的錯誤:

Starting puppetmaster: /usr/lib/ruby/site_ruby/1.8/puppet/util/pidlock.rb:39:in

initialize': Permission denied - /var/lib/puppet/run/master.pid (Errno::EACCES) from /usr/lib/ruby/site_ruby/1.8/puppet/util/pidlock.rb:39:in

open’

from /usr/lib/ruby/site_ruby/1.8/puppet/util/pidlock.rb:39:in

lock' from /usr/lib/ruby/site_ruby/1.8/puppet/daemon.rb:46:in

create_pidfile’

from /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:44:in

synchronize_on' from /usr/lib/ruby/1.8/sync.rb:230:in

synchronize’

from /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:44:in

synchronize_on' from /usr/lib/ruby/site_ruby/1.8/puppet/daemon.rb:45:in

create_pidfile’

from /usr/lib/ruby/site_ruby/1.8/puppet/daemon.rb:21:in

daemonize' from /usr/lib/ruby/site_ruby/1.8/puppet/application/master.rb:193:in

main’

from /usr/lib/ruby/site_ruby/1.8/puppet/application/master.rb:146:in

run_command' from /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:309:in

run’

from /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:416:in

hook' from /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:309:in

run’

from /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:407:in

exit_on_fail' from /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:309:in

run’

from /usr/sbin/puppetmasterd:4

三、解決方法:

因為使用puppetmasterd –genconfig指令生成的puppet.conf當中,rundir為/var/lib/puppet/run,将其改為

rundir =/var/lib/puppet/run

即可。

(PS: pidfile改為$rundir/master.pid)

繼續閱讀