Ask Your Question

Do I need to backup PuppetDB? If so, how?

asked 2012-12-19 12:53:23 -0500

zacharyalexstern gravatar image

updated 2013-01-03 11:02:32 -0500

llowder gravatar image

I've seen conflicting answers on this question. Does PuppetDB need to be backed up? How should it be backed up, if yes?

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2012-12-19 13:31:00 -0500

jtopjian gravatar image

I think it depends on how critical the database of your resource state is.

In my opinion, I don't find backing up PuppetDB useful. Because PuppetDB stores the current state of resources, I feel that simply letting a new / empty PuppetDB database collect the current state of resources is good enough.

However, if your systems rely on having access to the current state immediately, then you should do some type of backup. For example, if you implement an empty PuppetDB database, you will have wait up to an hour before all resources have been collected and all nodes know ... (more)

edit flag offensive delete link more


it is not wise to ever run with empty puppetdb. your monitoring or acls might rely on it and - if properly written - got wiped. and because there is no way ...(more)

asq gravatar imageasq ( 2012-12-19 16:29:10 -0500 )edit

I agree with the method you use as a precaution, but I have never run into a scenario where the removal / purge of the database has caused those resources to ...(more)

jtopjian gravatar imagejtopjian ( 2012-12-19 16:54:09 -0500 )edit

ie. we use exported resources for squid acl, they are stored as individual files in /etc/squid/acl directory, which is managed by puppet with purge => true attribute, so it ...(more)

asq gravatar imageasq ( 2012-12-19 17:22:58 -0500 )edit

OK, purge will definitely ruin your day if you lose PuppetDB. In that scenario, my answer about recommending backing up or some other type of HA solution is valid for that.

jtopjian gravatar imagejtopjian ( 2012-12-19 17:49:39 -0500 )edit

While I'm not making an argument against backing up your data, if you do lose it you can safely restore it by running every node in noop mode once ...(more)

nick gravatar imagenick ( 2012-12-20 04:27:01 -0500 )edit

answered 2012-12-28 22:20:53 -0500

updated 2013-08-15 10:23:14 -0500

As with any question of this sort, it depends on what you want to do.

At the time of me writing this - PuppetDB stores:

  • The most recent facts from every node
  • The most recent catalog from every node

What needs this data? Exported resources for one ... and if you are using any PuppetDB query funcitons - yep its needed. The thing is though, this data can be repopulated in a giffy by running Puppet again on all hosts. So what are the risks here:

  • You were using exported resources to add nodes to a load-balancer, you got the resource set to ...
edit flag offensive delete link more

answered 2012-12-19 16:28:49 -0500

dblessing gravatar image

I agree with jtopjian. However, to answer the original question, you should be able to back up PuppetDB by simply using standard tools to back up the underlying database. i.e. Use a postgres backup tool if you're using the postgres backend. There is nothing that gets persisted in the Puppet DB front-end (Java-side).

edit flag offensive delete link more


Thanks! I meant to add that in my answer.

jtopjian gravatar imagejtopjian ( 2012-12-19 16:49:49 -0500 )edit

while postgres is persistency layer, there is asynchronius job which commits puppetdb cache to it. i believe that it depends on load how long you need to wait before your ...(more)

asq gravatar imageasq ( 2012-12-19 17:32:04 -0500 )edit

So then the question still remains, how do we back it up? We aren't using postgres.

zacharyalexstern gravatar imagezacharyalexstern ( 2012-12-21 12:20:40 -0500 )edit

@zacharyalexstern If you're not using Postgres you're using the built-in Hypersonic db. While that's great for testing, it is not really great practice for production systems unless ...(more)

dblessing gravatar imagedblessing ( 2012-12-21 15:53:08 -0500 )edit

@dblessing we only have a small number of nodes currently. Will move to Postgres if performance suffers.

zacharyalexstern gravatar imagezacharyalexstern ( 2012-12-21 16:07:42 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2012-12-19 12:53:23 -0500

Seen: 1,352 times

Last updated: Aug 15 '13