PuppetDB配置不起作用

时间:2017-03-27 21:44:43

标签: puppet

我正在尝试在同一个puppet主服务器上配置puppetDB。我按照puppet文档,安装了数据库并配置了puppet来使用数据库。

当我运行puppet agent --test命令时,它给出了以下错误消息。

我没有看到任何进程在端口8081中运行,我看到在端口8140上运行了puppet java进程。

如何解决此错误?

Warning: Unable to fetch my node definition, but the agent run will continue:
Warning: Error 500 on SERVER: Server Error: Could not retrieve facts for webserver: Failed to find facts from PuppetDB at puppet:8140: Failed to execute '/pdb/query/v4/nodes/webserver/facts' on at least 1 of the following 'server_urls': https://puppetdb:8081
Info: Retrieving pluginfacts
Info: Retrieving plugin
Warning: Error connecting to puppetdb on 8081 at route /pdb/query/v4/nodes/webserver/facts, error message received was 'Connection refused - connect(2) for "puppetdb" port 8081'. Failing over to the next PuppetDB server_url in the 'server_urls' list
Error: Cached facts for webserver failed: Failed to find facts from PuppetDB at puppet:8140: Failed to execute '/pdb/query/v4/nodes/webserver/facts' on at least 1 of the following 'server_urls': https://puppetdb:8081
Info: Loading facts
Info: Caching facts for webserver
Warning: Error connecting to puppetdb on 8081 at route /pdb/cmd/v1?checksum=039e22c7bf98e9cbf2f08169047d288c9b451c73&version=5&certname=webserver&command=replace_facts, error message received was 'Connection refused - connect(2) for "puppetdb" port 8081'. Failing over to the next PuppetDB server_url in the 'server_urls' list
Error: Failed to execute '/pdb/cmd/v1?checksum=039e22c7bf98e9cbf2f08169047d288c9b451c73&version=5&certname=webserver&command=replace_facts' on at least 1 of the following 'server_urls': https://puppetdb:8081
Error: Could not retrieve local facts: Failed to execute '/pdb/cmd/v1?checksum=039e22c7bf98e9cbf2f08169047d288c9b451c73&version=5&certname=webserver&command=replace_facts' on at least 1 of the following 'server_urls': https://puppetdb:8081
Error: Failed to apply catalog: Could not retrieve local facts: Failed to execute '/pdb/cmd/v1?checksum=039e22c7bf98e9cbf2f08169047d288c9b451c73&version=5&certname=webserver&command=replace_facts' on at least 1 of the following 'server_urls': https://puppetdb:8081

2 个答案:

答案 0 :(得分:0)

由于某种原因,puppetdb进程失败了,这就是没有进程在端口8081上运行的原因。我重启了puppetdb进程,然后agent -test命令声明连接到网络服务器。

以下是centos 7中puppetdb服务的输出。

# systemctl status puppetdb
● puppetdb.service - puppetdb Service
   Loaded: loaded (/usr/lib/systemd/system/puppetdb.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2017-03-28 18:26:58 EDT; 1h 20min ago
 Main PID: 5503 (java)
   CGroup: /system.slice/puppetdb.service
           └─5503 /usr/bin/java -Xmx192m -Djava.security.egd=/dev/urandom -XX:OnOutOfMemoryError=kill -9 %p -cp /opt/puppetlabs/...

答案 1 :(得分:0)

希望您检查executemany()中存储的SSL证书是否与df.D = df.D.astype('str') print(df.to_records(index=False)) # [(3, 0.141, 'five-nine', '2018-03-07 20:40:39.808427') # (1, 0.41 , 'four-two', '2018-03-07 20:40:39.808427')] 匹配。

这可以通过

验证

puppetdb ssl-setup

示例条目

db = sqlite3.connect(':memory:')
c = db.cursor()
c.execute('create table if not exists ABCD ( A integer, B real, C text, D timestamp );')
c.execute('insert into ABCD (A,B,C, D) values (?,?,?,?);',(1,2.2,'4',nowtime))

df['D'] = df['D'].astype('str')
c.executemany('insert into ABCD (A,B,C, D) values (?,?,?,?);',df.to_records(index=False))

db.commit()
print(pd.read_sql('select * from ABCD;',db))

#    A      B          C                           D
# 0  1  2.200          4  2018-03-07 20:47:15.031130
# 1  3  0.141  five-nine  2018-03-07 20:47:15.031130
# 2  1  0.410   four-two  2018-03-07 20:47:15.031130

如果您还有其他问题,请与我们联系。我遇到了同样的问题并通过删除/etc/puppetlabs/puppetdb/ssl目录并重新运行&#34; /etc/puppetlabs/puppet/ssl/certs/<certnameof your puppetserver.FQDN>&#34;来解决问题。命令。