Re: [Puppet Users] Re: Need to move puppetdb database -- best approach?

194 views
Skip to first unread message

Wyatt Alt

unread,
Aug 17, 2016, 2:41:38 PM8/17/16
to puppet...@googlegroups.com, Bret Wortman


On 8/17/16 6:26 AM, Bret Wortman wrote:

On Wednesday, August 17, 2016 at 9:19:34 AM UTC-4, Bret Wortman wrote:
I'll confess that I know next to nothing about Postgres databases, so I'm going to ask before I royally mess anything up: what's the best way to relocate my database from one partition to another? I need to move my files from their current location (which seems to be /opt/puppetlabs/server/data/puppetdb/mq/localhost to somewhere under /data. I know I'll need to shut puppetdb and postgresql down to do the move, but how do I ensure everything is available & ready when I need to bring things back up again?

The reason is that I'm getting messages in my puppetdb log files like this:

Store limit is 102400 mb (current store usage is 10 mb). The data directory: /opt/puppetlabs/server/data/puppetdb/mq/localhost/KahaDB only ahs 20671 mb of usable space - resetting to maximum available disk space: 20682.

Before going down the road of moving postgres, note that this error isn't actually talking about postgres, but rather PuppetDB's vardir, which is used by activemq. Vardir can be changed with this parameter: https://docs.puppet.com/puppetdb/latest/configure.html#vardir.

The warning is saying you only have 20 gigs of space in your vardir, and so the store limit will be reset to 20 gigs instead of the default of 100. You can make the warning go away by setting this parameter to 20 gigs: https://docs.puppet.com/puppetdb/latest/configure.html#store-usage, or you can change the vardir parameter to point somewhere on /data, though the queue will not generally get to 20 gigs unless something is very wrong (note that you currently use 10mb). The warning is common and not generally a big deal.

If it happens that postgres is also on that 20 gig partition and you're still worried about that, the process for moving the cluster would be

* stop puppetdb and postgres
* copy the postgres data directory (can be located with "show data_directory;" run in psql) to the /data partition using cp -a, to keep permissions
* update the PGDATA variable in your postgres systemd unit file to point to the new location
* restart postgres + puppetdb

If all goes well things will start up, and you can delete the original, but you may have to work through some permissions issues to ensure that the postgres user really can access the new location. I'd definitely recommend testing the process first and somehow ensuring you're able to wind it back easily.

Wyatt


The /data partition is much larger and I won't have to worry about filling up my root partition this way.

Thanks,


Bret
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/a04a8c97-2047-4877-aa85-e259796d80cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Bret Wortman

unread,
Aug 17, 2016, 3:11:13 PM8/17/16
to Puppet Users, br...@thewortmans.org
Yeah, I realized this was a red herring and deleted the original post before writing the other you've been helping me with. I also realized that the contents of the directory indicated was so small that it couldn't be nearing a resource limitation. Thanks for the directions, though, I'll definitely file them away just in case.
Reply all
Reply to author
Forward
0 new messages