Thread: graceful reload

graceful reload

From
Vasiliy G Tolstov
Date:
Hello.

I'm use linux and postgresql under xen vps. Vps supports memory balloon
(i need to increase memory some time). Can postgresql server has ability
to graceful reload itself after it configuration files changed?
Thank You.

--
Vasiliy G Tolstov <v.tolstov@selfip.ru>
Selfip.Ru


Re: graceful reload

From
"Anh Ky Huynh"
Date:
On Thu, 03 Jun 2010 10:23:36 +0400
Vasiliy G Tolstov <v.tolstov@selfip.ru> wrote:

> Hello.
>
> I'm use linux and postgresql under xen vps. Vps supports memory
> balloon (i need to increase memory some time). Can postgresql
> server has ability to graceful reload itself after it configuration
> files changed? Thank You.

I'm afraid *NOT*. You can write a script / cronjob for this task. The script will check postgresql periodically and
willrestart posgresql daemon in case the configuration was changed. You can use `stat` command (try `stat --help`) to
getthe right information about file's modifcation. You should *check* if your configuration is valid before restart the
daemonas any wrong modification can cause your server to stop :) 

I know there's a tool that will do some tasks whenever a(ny) file in the system has been modified. But I can't remember
thename of that tool. 

Regards,

--
Anh Ky Huynh

Re: graceful reload

From
Vasiliy G Tolstov
Date:
В Чтв, 03/06/2010 в 14:45 +0700, Anh Ky Huynh пишет:
> On Thu, 03 Jun 2010 10:23:36 +0400
> Vasiliy G Tolstov <v.tolstov@selfip.ru> wrote:
>
> > Hello.
> >
> > I'm use linux and postgresql under xen vps. Vps supports memory
> > balloon (i need to increase memory some time). Can postgresql
> > server has ability to graceful reload itself after it configuration
> > files changed? Thank You.
>
> I'm afraid *NOT*. You can write a script / cronjob for this task. The script will check postgresql periodically and
willrestart posgresql daemon in case the configuration was changed. You can use `stat` command (try `stat --help`) to
getthe right information about file's modifcation. You should *check* if your configuration is valid before restart the
daemonas any wrong modification can cause your server to stop :) 
>
> I know there's a tool that will do some tasks whenever a(ny) file in the system has been modified. But I can't
rememberthe name of that tool. 
>
> Regards,
>

Sorry for incorrect question. I mean: does postgresql can be reloaded
without breaking current connections?
For example:
I need to increate some values in postgresql conf file and want to this
valies applied on running server, can i do this without full restart?

--
Vasiliy G Tolstov <v.tolstov@selfip.ru>
Selfip.Ru


Re: graceful reload

From
Shoaib Mir
Date:
On Thu, Jun 3, 2010 at 5:48 PM, Vasiliy G Tolstov <v.tolstov@selfip.ru> wrote:
Sorry for incorrect question. I mean: does postgresql can be reloaded
without breaking current connections?
For example:
I need to increate some values in postgresql conf file and want to this
valies applied on running server, can i do this without full restart?


Which settings you want to change? as there are some which can be done with just a database reload but some of them cant be done without doing a database restart (like some memory related settings)

--
Shoaib Mir
http://shoaibmir.wordpress.com/

Re: graceful reload

From
Vasiliy G Tolstov
Date:
В Чтв, 03/06/2010 в 17:54 +1000, Shoaib Mir пишет:
> On Thu, Jun 3, 2010 at 5:48 PM, Vasiliy G Tolstov
> <v.tolstov@selfip.ru> wrote:
>         Sorry for incorrect question. I mean: does postgresql can be
>         reloaded
>         without breaking current connections?
>         For example:
>         I need to increate some values in postgresql conf file and
>         want to this
>         valies applied on running server, can i do this without full
>         restart?
>
>
>
> Which settings you want to change? as there are some which can be done
> with just a database reload but some of them cant be done without
> doing a database restart (like some memory related settings)
>

Memory related:
max_connections
shared_buffers
temp_buffers
max_prepared_transactions
work_mem
maintenance_work_mem
max_stack_depth
max_files_per_process
wal_buffers

In config file some in of this settings exists comment line like
"changes require restart". This is mean exactly restart or reload can do
this?


--
Vasiliy G Tolstov <v.tolstov@selfip.ru>
Selfip.Ru


Re: graceful reload

From
Shoaib Mir
Date:
On Thu, Jun 3, 2010 at 6:01 PM, Vasiliy G Tolstov <v.tolstov@selfip.ru> wrote:

Memory related:
max_connections
shared_buffers
temp_buffers
max_prepared_transactions
work_mem
maintenance_work_mem
max_stack_depth
max_files_per_process
wal_buffers

In config file some in of this settings exists comment line like
"changes require restart". This is mean exactly restart or reload can do
this?



For these you really need a database restart as reload will not help. 

--
Shoaib Mir
http://shoaibmir.wordpress.com/

Re: graceful reload

From
Greg Smith
Date:
Vasiliy G Tolstov wrote:
> In config file some in of this settings exists comment line like
> "changes require restart". This is mean exactly restart or reload can do
> this?
>

Run this:

$ psql -c "select name,context from pg_settings"

This will sort out which settings are in which category definitively,
rather than relying on the sometimes ambiguous comments in the file.
Settings that say "postmaster" require a full database restart.  Ones
labeled "sighup" can be changed in the postgresql.conf and then the
server signaled to use them, most easily with:

pg_ctl reload
-OR-
psql -c "select pg_reload_conf()"

Ones labeled "user" you can actually change for any user at any time
during their session.  Modifying the defaults and then executing the
sighup procedure will make those new defaults active, but not for any
clients that already have open connections.

I recommend using SHOW or looking at pg_settings after making a change
and reloading the server config to confirm it took.

--
Greg Smith  2ndQuadrant US  Baltimore, MD
PostgreSQL Training, Services and Support
greg@2ndQuadrant.com   www.2ndQuadrant.us


Re: graceful reload

From
Vasiliy G Tolstov
Date:
В Чтв, 03/06/2010 в 13:07 -0400, Greg Smith пишет:
> Vasiliy G Tolstov wrote:
> > In config file some in of this settings exists comment line like
> > "changes require restart". This is mean exactly restart or reload can do
> > this?
> >
>
> Run this:
>
> $ psql -c "select name,context from pg_settings"
>
> This will sort out which settings are in which category definitively,
> rather than relying on the sometimes ambiguous comments in the file.
> Settings that say "postmaster" require a full database restart.  Ones
> labeled "sighup" can be changed in the postgresql.conf and then the
> server signaled to use them, most easily with:
>
> pg_ctl reload
> -OR-
> psql -c "select pg_reload_conf()"
>
> Ones labeled "user" you can actually change for any user at any time
> during their session.  Modifying the defaults and then executing the
> sighup procedure will make those new defaults active, but not for any
> clients that already have open connections.
>
> I recommend using SHOW or looking at pg_settings after making a change
> and reloading the server config to confirm it took.
>

Ok, Thank You very much! This is really helpful.

--
Vasiliy G Tolstov <v.tolstov@selfip.ru>
Selfip.Ru