设为首页 收藏本站
查看: 1107|回复: 0

[经验分享] puppet server升级,puppet 常见错误解决

[复制链接]
YunVN网友  发表于 2018-8-3 09:10:57 |阅读模式
  在今天签名证书的时候出现一个问题,就是我的agent 比 server版本新,所以导致出现了这样的错误
  notice: Starting Puppet client version 2.7.11
  err: Could not retrieve catalog from remote server: Error 400 on SERVER: No support for http method POST
  notice: Using cached catalog
  err: Could not retrieve catalog; skipping run
  ^Cnotice: Caught INT; calling stop
  因为yum源上的最新版本截止到现在是2.6.17,现在只有通过rubygems 的方式进行update(注:我的原则,现在尽量不用源码就不用源码,那种菊花疼的事,你们懂的)
  升级步骤如下(个人只是在测试下升级,生成环境,做好你的备份):
  


  • [root@server ssl]# puppet --version
  • 2.6.17
  • [root@server ssl]# yum -y install rubygems
  • [root@server ssl]# gem install puppetserver
  • ERROR:  could not find gem puppetserver locally or in a repository
  • [root@server ssl]# gem install puppet
  • Successfully installed facter-1.6.11
  • Successfully installed puppet-2.7.19
  • 2 gems installed
  • Installing ri documentation for facter-1.6.11...
  • Installing RDoc documentation for facter-1.6.11...
  • Could not find main page README
  • Could not find main page README
  • Could not find main page README
  • Could not find main page README
  • [root@server ssl]# puppet --version
  • 2.7.19
  

  另google 摘抄了一些 puppet的常见error,及解决办法
  【puppet 常见错误列表】
  1.Failed to retrieve current state of resource: Could not retrieve information from source(s)
  err: //test/File[/tmp/sky]: Failed to retrieve current state of resource: Could not retrieve information from source(s) puppet:///test/foo at /etc/puppet/modules/test/manifests/init.pp:6
  解决方法:这是一般大多人犯的问题,这个问题一般是出现在puppetmaster上,大部分是source这个路径没有写对。可以查看init.pp的第6行,
  一般正确的写法是source => “puppet:///test/sky”,关于文件服务器的写法,可以参阅之前的sky的文档.
  2.Could not retrieve information from environment production source(s) puppet://server.puppet.com/plugins
  解决方法:这是一般都是通过yum或者apt-get安装了puppet,在puppetmaster和客户端的配置文件 里有pluginsync=true ,
  把两端/etc/puppet.conf里pluginsync=true ,改成pluginsync=false,并重启puppetmaster即可解决。
  再补充一种方法,如果不设置pluginsync=false,那么就需要到少要建个插件。
  3.Could not request certificate: undefined method `closed?’
  err: Could not request certificate: undefined method `closed?' for nil:NilClass Exiting;
  failed to retrieve certificate and watiforcert is disabled
  解决方法:a.确保puppet的运行用户是否有权限读ssl认证文件。
  b.确认防火墙是否打开8140端口。

4.Change from absent to file failed
  err: //test/File[/tmp/sky/www.mysqlops.com]/ensure: change from absent to file failed: Could not set file on ensure: No such file or directory
  解决方法:很明显,可能是没有/tmp/sky这个目录,如果没有,请使用 mkdir -p /tmp/sky.

5.Run of Puppet configuration client already in progress
  解决方法,很明显,a.可以通过ps -axf|grep puppet是否有puppet进程在运行。如果有,则停掉puppet,再运行,即可。
  b.没有进程,那有可能puppetdlock存在,则删除之,使用 rm -rf /var/puppet/state/puppetdlock
  

  

  

6.Change failed ... Could not find server  

  err: //test/File[/tmp/sky]/content: change from {md5}068008008418dff20750a94336318974 to {md5}8db2d67767577c70b1251fd80ad32943 failed: Could not find server puppet
  解决方法:这是设置了filebucket, 名称为puppet,但并不没有使用真名。在配置文件/etc/puppet.conf里设置如下:
  

filebucket { puppetmaster: server => "www.mysqlops.com" # server后面要用全名,即fqdn. }  

  

7.Could not retrieve catalog: can't convert nil into String  

  err: Could not retrieve catalog: can't convert nil into String at /etc/puppet/modules/test/manifests/init.pp:29 on node web-01.test.com
  解决方法:确认模板文件是否存在。一般都是文件不存在的时候报的。
  8.undefined method `closed?’ for nil:NilClass
  err: Could not retrieve catalog from remote server: undefined method `closed?' for nil:NilClas
  解决方法:经常可能是语法错误,少了双引号或者 大概号什么的。
  9.certificate verify failed
  err: /File[/var/lib/puppet/lib]: Failed to generate additional resources using 'eval_generate': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
  
err: /File[/var/lib/puppet/lib]: Failed to retrieve current state of resource: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed Could not retrieve file metadata for puppet://puppet.example.com/plugins: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
  
err: Could not retrieve catalog from remote server: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
  解决方法:这可能是换了不同的两台puppetmaster服务器引起的。解决方法,删除现有ssl证书。find /var/lib/puppet -type f -print0 |xargs -0r rm
  10.Could not retrieve catalog from remote server
  err: Could not retrieve catalog from remote server: No such file or directory - /var/lib/puppet/client_yaml/catalog
  解决方法:明显提示,/var/lib/puppet/client_yaml/可能不存在,没有则创建之。
  11.no certificate found and waitforcert is disabled
  warning: peer certificate won’t be verified in this SSL session
  
Exiting; no certificate found and waitforcert is disabled
  解决方法:    这个是需要puppetmaster端给客户端ssl签名.
  a.puppetca -l #列出等待签名的客户端
  b.puppetca -s hostname # hostname 是客户端主机的名字。

  12.Could not intern from pson: Could not convert from pson: Could not find>  解决方法:这是一个bug, 针对版本0.25.1.在puppet0.25.5.1版本中可以在/etc/puppet/puppet.conf里添加
  preferred_serialization_format = yaml 即可解决。
  13.Error 400 on SERVER: No support for http method POST
  err: Could not retrieve catalog from remote server: Error 400 on SERVER: No support for http method POST
  解决方法:这个问题可能是puppetmaster是2.6版本,puppet客户端版本是2.7。请记住 ,puppetmaster版本可以大于或者等于客户端的版本。
  不能小于,互换下puppet角色,即可。
  14.You cannot specify more than one of content, source, target
  err: Could not run Puppet configuration client: You cannot specify more than one of content, source, target at /etc/puppet/modules/test/manifests/init.pp:10
  解决方法:错误提示很显示,不能为一个文件指定多个来源。
  15.Could not retrieve catalog from remote server: wrong header line format
  解决方法,可能是模板语法错误,请使用命令检查模板语法,示例:erb -x -T ‘-’ -P  test/templates/cron/cron.erb  |ruby -c
  16.Cannot override local resource on node
  err: Could not retrieve catalog from remote server: Error 400 on SERVER: Exported resource skyd[foo] cannot override local resource on node web-01.mysqlops.com
  解决方法:这个问题,一般是在使用export 虚拟资源的时候会出现,可能是有重复的定义。
  这可能是由于旧节点,运行puppet clean node。查看数据库。使用下面的sql

  “select hosts.name from hosts,resources where restype=’skyd’ and>  17.Could not render to pson: invalid utf8 byte
  err: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not render to pson: invalid utf8 byte:
  解决方法:可能是有无效的utf8字符,可以使用命令:od -c filename 进行检查。

18. 在安装dashboad的时候,报
  

RAILS_ENV=production db:migrate --trace (in /usr/local/puppet-dashboard) ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:migrate ** Invoke db:schema:dump (first_time) ** Invoke environment ** Execute db:schema:dump rake aborted! undefined method `reenable' for <Rake::Task db:schema:dump => [environment]>:Rake::Task  

解决访问,可能是gem版本不对,升级版本,请确认版本是否满足安装dashboad的要求。  

19.在执行facter命令的时候报:
  

err: Could not run Puppet configuration client: Could not retrieve local facts: execution expired  

解决方法,由于ubuntu升级导致的ec2.rb有新的改动,可以修改/usr/lib/ruby/1.8/facter这个目录下面的ec2.rb文件后从新启动后解决。 具体解决方法如下:1. cd /usr/lib/ruby/1.8/facter  

                2. cp ec2.rb{,.`date -I`} #备份新的ec2.rb这个文件  

                3. 从正常执行的主机复制ec2.rb这个文件进行覆盖。或者比较两个文件的不同,进行修改。  

20.在使用gem 安装的时候会报:
  

ERROR:  Could not find a valid gem 'rake' (>= 0) in any repository ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)  

  解决方法:可能是没有gem源,或者无法访问源,大部分是网络问题。
  可以多添加下几个gem 源来尝试解决:
  使用命令:


  • gem sources -a http://gems.rubyforge.org
  • gem sources -a http://gems.rubyonrails.org
  • gem sources -a http://gemcutter.org
  • gem sources -a http://rubygems.org
  添加了上面的四个gem源,希望能解决,另外使用gem 安装的过程比较慢,需要大家耐心点等待提示。
  21.err: Could not request certificate: Retrieved certificate does not match private key; please remove certificate from server and regenerate it with the current key
  解决方法:按照下面a-d四个步骤,即可。
  a.在客户端可以删除rm -rf /var/lib/puppet/ssl/,
  b.在puppetmaster端,执行 puppetca -c 客户端主机名
  c. 客户端在重新生成证书请求: puppet –test –server puppetmaster主机名
  d.在puppetmaster端,执行 puppetca -s 客户端主机名

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-545670-1-1.html 上篇帖子: puppet 签名证书 下篇帖子: httpd+passenger处理puppet大并发
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表