For large PuppetDB installations, you can speed initial replication by manually copying the database from the master to the replica. If you have already started automatic provisioning, you can manually copy your PuppetDB at any time during sync.
The size of your PuppetDB correlates with the number of nodes and resources in your Puppet catalogs. To optionally examine the size of your database, on the PuppetDB PostgreSQL node, run
sudo -u pe-postgres /opt/puppetlabs/server/bin/psql -c '\l+ "<DB_NAME>"'.
- On the PuppetDB node, export the database:
sudo -u pe-postgres /opt/puppetlabs/server/bin/pg_dump --format=custom --compress=3 --file=<DUMP_OUTPUT> --dbname="<DB_NAME>"
- On the PuppetDB node, transfer the output using your preferred tool, such as SCP:
scp -r <DUMP_OUTPUT> <REMOTE_USER>@<REPLICA_HOST>:<REPLICA_DUMP_OUTPUT>
- On the primary replica node, restore PuppetDB:
sudo puppet resource service puppet ensure=stopped sudo puppet resource service pe-puppetdb ensure=stopped sudo -u pe-postgres /opt/puppetlabs/server/bin/pg_restore --clean --jobs=<PROCESSOR_COUNT> --dbname="<DB_NAME>" <REPLICA_DUMP_OUTPUT> sudo puppet resource service puppet ensure=running sudo puppet resource service pe-puppetdb ensure=running sudo puppet agent -t
After manual export and restore, PuppetDB automatically updates the replica with any changes that occurred on the master in the meantime.