Re: How to detect if Postgres needs a restart when configuration changes

From: Stuart Bishop <stuart(at)stuartbishop(dot)net>
To: Strahinja Kustudić <strahinjak(at)nordeus(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Jason Mathis <jmathis(at)redzonesoftware(dot)com>, Ian Barwick <ian(at)2ndquadrant(dot)com>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: How to detect if Postgres needs a restart when configuration changes
Date: 2014-10-01 12:18:34
Message-ID: CADmi=6Ma_sfW9vWja=wLx2oYmRGa9JmdS2OtKS6MBGn=8NVF4g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On 1 October 2014 16:18, Strahinja Kustudić <strahinjak(at)nordeus(dot)com> wrote:
> On Wed, Oct 1, 2014 at 6:56 AM, Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
>>
>> On Tue, 2014-09-30 at 18:51 -0600, Jason Mathis wrote:
>> > How are you automating? Have you looked at puppet or anything? Puppet
>> > labs maintains a postgresql module that has all that baked in. Check
>> > it out at least it can give you some ideas.
>>
>> Their "idea" is to maintain a hard-coded list about which parameter
>> changes need a restart, and their list is wrong.
>
>
> I'm deploying Postgres with Ansible, so Puppet doesn't help.
>
> The idea of maintaining a list of parameters which require a restarts is ok
> for automation, since you usually only change a few of them. I also have a
> list of those parameters which can be changed by Ansible and I would like to
> detect if any of them changed, so I know I need to restart. Or it would be
> even better if Postgres can tell me if it requires a restart to apply all
> parameter changes, something like when you send SIGHUP and in the log it
> tells you that a parameter can only be changed after restart. But I can see
> that doesn't exist.

It is unnecessary maintaining a list of parameters which require a
restart, as you can tell by looking at pg_settings.

The way I do it is by comparing the contents of pg_settings with a
snapshot I made just after (or just before) the server was last
restarted. If any settings have been changed that have a context of
'postmaster', the server needs a restart.

--
Stuart Bishop <stuart(at)stuartbishop(dot)net>
http://www.stuartbishop.net/

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Ruben Domingo Gaspar Aparicio 2014-10-02 13:07:29 hot_standby lagging behind 9.2.9
Previous Message Shreeyansh dba 2014-10-01 10:59:09 Re: How to detect if Postgres needs a restart when configuration changes