0

For auditing purposes we are required to retain put puppet database for 7 years, how may I routinely dump it into a MySQL database, I might have some flexibility in the choice of databases, postgres or MySql.

Thanks in advance.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
a3kartik
  • 105
  • 1
  • 7

1 Answers1

1

If you're using Postgres as the backing store for PuppetDB, then you can just use the vanilla postgres tools (like pg_dump) to dump a complete copy of the db, then use psql or pg_restore to put that into a clean postgres database for archival purposes. Repeat as necessary.

PuppetDB also has a built-in "export" command (see the section in the puppetdb docs on "Exporting and anonymizing data"). That will dump out all of your current catalogs, facts, and reports into a tarball on disk. If your auditors just care about archival access to the raw data (i.e. it doesn't need to be in a DB for querying or anything), maybe that's sufficient?

PuppetDB doesn't work with MySQL as a backing store. If you want to dump its contents to a MySQL db, I'd recommend using the "export" I mentioned earlier, expanding that tarball, then writing a custom script that imports that data in MySQL.

steveax
  • 17,527
  • 6
  • 44
  • 59
grim_radical
  • 131
  • 2
  • Thank you very much, I need the default password for the users: pe-postgres and pe-puppetdb. The command, /opt/puppetlabs/server/bin/pg_dump pe-puppetdb -U pe-puppetdb -h localhost -F c > /var/tmp/db.$(date +%Y-%m-%d%H:%M:%S).dump Password: prompts me for a password – a3kartik Jul 30 '16 at 12:17
  • I am now able to do a dump_all and then restore, but having some issues, documented here: http://pastebin.com/2kqH5as6 – a3kartik Aug 08 '16 at 19:01