[root@cu3 ~]# yum install puppetdb
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
* epel: ftp.cuhk.edu.hk
Resolving Dependencies
--> Running transaction check
---> Package puppetdb.noarch 0:4.0.0-1.el6 will be installed
--> Processing Dependency: java-1.8.0-openjdk-headless for package: puppetdb-4.0.0-1.el6.noarch
--> Running transaction check
---> Package java-1.8.0-openjdk-headless.x86_64 1:1.8.0.77-0.b03.el6_7 will be installed
--> Processing Dependency: tzdata-java >= 2014f-1 for package: 1:java-1.8.0-openjdk-headless-1.8.0.77-0.b03.el6_7.x86_64
--> Processing Dependency: jpackage-utils for package: 1:java-1.8.0-openjdk-headless-1.8.0.77-0.b03.el6_7.x86_64
--> Running transaction check
---> Package jpackage-utils.noarch 0:1.7.5-3.14.el6 will be installed
---> Package tzdata-java.noarch 0:2016c-1.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===========================================================================================================================================================================================
Package Arch Version Repository Size
===========================================================================================================================================================================================
Installing:
puppetdb noarch 4.0.0-1.el6 puppet-local 21 M
Installing for dependencies:
java-1.8.0-openjdk-headless x86_64 1:1.8.0.77-0.b03.el6_7 updates 32 M
jpackage-utils noarch 1.7.5-3.14.el6 base 60 k
tzdata-java noarch 2016c-1.el6 updates 179 k
Transaction Summary
===========================================================================================================================================================================================
Install 4 Package(s)
Total size: 53 M
Total download size: 53 M
Installed size: 126 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): java-1.8.0-openjdk-headless-1.8.0.77-0.b03.el6_7.x86_64.rpm | 32 MB 00:00
(2/3): puppetdb-4.0.0-1.el6.noarch.rpm | 21 MB 00:00
(3/3): tzdata-java-2016c-1.el6.noarch.rpm | 179 kB 00:00
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 32 MB/s | 53 MB 00:01
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : tzdata-java-2016c-1.el6.noarch 1/4
Installing : jpackage-utils-1.7.5-3.14.el6.noarch 2/4
Installing : 1:java-1.8.0-openjdk-headless-1.8.0.77-0.b03.el6_7.x86_64 3/4
Installing : puppetdb-4.0.0-1.el6.noarch 4/4
Config archive not found. Not proceeding with migration
PEM files in /etc/puppetlabs/puppetdb/ssl are missing, we will move them into place for you
Warning: Unable to find all puppet certificates to copy
This tool requires the following certificates to exist:
* /etc/puppetlabs/puppet/ssl/certs/ca.pem
* /etc/puppetlabs/puppet/ssl/private_keys/cu3.esw.cn.pem
* /etc/puppetlabs/puppet/ssl/certs/cu3.esw.cn.pem
These files may be missing due to the fact that your host's Puppet
certificates may not have been signed yet, probably due to the
lack of a complete Puppet agent run. Try running puppet first, for
example:
puppet agent --test
Afterwards re-run this tool then restart PuppetDB to complete the SSL
setup:
puppetdb ssl-setup -f
Verifying : jpackage-utils-1.7.5-3.14.el6.noarch 1/4
Verifying : tzdata-java-2016c-1.el6.noarch 2/4
Verifying : puppetdb-4.0.0-1.el6.noarch 3/4
Verifying : 1:java-1.8.0-openjdk-headless-1.8.0.77-0.b03.el6_7.x86_64 4/4
Installed:
puppetdb.noarch 0:4.0.0-1.el6
Dependency Installed:
java-1.8.0-openjdk-headless.x86_64 1:1.8.0.77-0.b03.el6_7 jpackage-utils.noarch 0:1.7.5-3.14.el6 tzdata-java.noarch 0:2016c-1.el6
Complete!
[root@cu3 ~]# puppet agent --server cu2.esw.cn --test
Info: Creating a new SSL key for cu3.esw.cn
Info: Caching certificate for ca
Info: csr_attributes file loading from /etc/puppetlabs/puppet/csr_attributes.yaml
Info: Creating a new SSL certificate request for cu3.esw.cn
Info: Certificate Request fingerprint (SHA256): 16:CB:A3:6D:21:69:78:D0:0D:37:1F:A7:C1:86:2E:55:7F:B1:60:77:05:EC:F5:37:81:12:28:73:61:1A:4F:20
Info: Caching certificate for ca
Exiting; no certificate found and waitforcert is disabled
# 服务端签名: puppet cert sign cu3.esw.cn
[root@cu3 ~]# puppet agent --server cu2.esw.cn --test
Info: Caching certificate for cu3.esw.cn
Info: Caching certificate_revocation_list for ca
Info: Caching certificate for cu3.esw.cn
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Caching catalog for cu3.esw.cn
Info: Applying configuration version '1461159906'
Info: Creating state file /opt/puppetlabs/puppet/cache/state/state.yaml
Notice: Applied catalog in 0.02 seconds
[root@cu3 ~]# puppetdb ssl-setup -f
PEM files in /etc/puppetlabs/puppetdb/ssl are missing, we will move them into place for you
Copying files: /etc/puppetlabs/puppet/ssl/certs/ca.pem, /etc/puppetlabs/puppet/ssl/private_keys/cu3.esw.cn.pem and /etc/puppetlabs/puppet/ssl/certs/cu3.esw.cn.pem to /etc/puppetlabs/puppetdb/ssl
Backing up /etc/puppetlabs/puppetdb/conf.d/jetty.ini to /etc/puppetlabs/puppetdb/conf.d/jetty.ini.bak.1461159930 before making changes
Updated default settings from package installation for ssl-host in /etc/puppetlabs/puppetdb/conf.d/jetty.ini.
Updated default settings from package installation for ssl-port in /etc/puppetlabs/puppetdb/conf.d/jetty.ini.
Updated default settings from package installation for ssl-key in /etc/puppetlabs/puppetdb/conf.d/jetty.ini.
Updated default settings from package installation for ssl-cert in /etc/puppetlabs/puppetdb/conf.d/jetty.ini.
Updated default settings from package installation for ssl-ca-cert in /etc/puppetlabs/puppetdb/conf.d/jetty.ini.
[root@cu3 ~]#
[root@cu3 ~]# vi /etc/puppetlabs/puppetdb/conf.d/database.ini
[database]
classname = org.postgresql.Driver
subprotocol = postgresql
# The database address, i.e. //HOST:PORT/DATABASE_NAME
subname = //cu2:5432/puppetdb
# Connect as a specific user
username = puppetdb
# Use a specific password
password = puppetdb
# How often (in minutes) to compact the database
# gc-interval = 60
# 通过api/name=num-active-nodes查询不到了,但是pgsql数据库中还没有删除。也可以通过 puppet node deactivate 手动执行
# node-ttl = 30d
# 默认没有设置,disabled。格式与node-ttl一样
# node-purge-ttl =
# report-ttl = 14d
# Number of seconds before any SQL query is considered 'slow'; offending
# queries will not be interrupted, but will be logged at the WARN log level.
log-slow-statements = 10
# 注意修改,不然web-ui就只能localhost访问了!!
[root@cu3 ~]# vi /etc/puppetlabs/puppetdb/conf.d/jetty.ini
...
host = 0.0.0.0
# JVM 参数修改
[root@cu3 ~]# less /etc/sysconfig/puppetdb
JAVA_BIN="/usr/local/jdk1.7.0_17/bin/java"
JAVA_ARGS="-XX:MaxPermSize=128m -Xmx2g"
[root@cu3 ~]# service puppetdb start
Starting puppetdb: [ OK ]
[root@cu3 ~]#
[root@cu3 ~]# service puppetdb status
puppetdb (pid 8452) is running...
# 8081 为 puppetserver 写数据的https接口。8080 为http web-ui端口
[root@cu3 ~]# netstat -anp | grep 8081
tcp 0 0 :::8081 :::* LISTEN 8794/java