Thread: shutting down postmasters

shutting down postmasters

From
"Poul L. Christiansen"
Date:
Hi

I'm using PostgreSQL 7.0.0 (PostgreSQL 7.0.0 on i686-pc-linux-gnu,
compiled by gcc egcs-2.91.66) on Redhat Linux 6.1.

When I start PostgreSQL, I use the command
/etc/rc.d/init.d/postgresql start
and pg_ctl starts.

I use Cold Fusion on Win2k as frontend to PostgreSQL, and Cold Fusion
opens up 10 postmasters.

When I want to shutdown PostgreSQL, I use the command
/etc/rc.d/init.d/postgresql stop

But only pg_ctl and one postmaster stops :-(

That means that I have to use the command "top" to see the other
postmaster processes and kill them one by one.

Isn't there an easir way to shutdown all postmasters? What if I had a
larger setup with 100 postmasters? That would take ages.....

Poul L. Christiansen


SV: shutting down postmasters

From
"Jarmo Paavilainen"
Date:
Hi,

...
> When I start PostgreSQL, I use the command
> /etc/rc.d/init.d/postgresql start
> and pg_ctl starts.
...
> But only pg_ctl and one postmaster stops :-(

killall postmaster; killall pg_ctl;

...
> Isn't there an easir way to shutdown all postmasters? What if I had a
> larger setup with 100 postmasters? That would take ages.....

*I think* "/etc/rc.d/init.d/postgresql stop" should do the trick.

// Jarmo


Re: shutting down postmasters

From
Tom Lane
Date:
"Poul L. Christiansen" <poulc@cs.auc.dk> writes:
> When I want to shutdown PostgreSQL, I use the command
> /etc/rc.d/init.d/postgresql stop
> But only pg_ctl and one postmaster stops :-(

"pg_ctl stop" performs a polite shutdown of the database --- ie,
existing clients are allowed to finish their sessions.  The postmaster
stops accepting new connections, but doesn't quit until the last
active backend quits.

"pg_ctl -m fast stop" is probably what you are looking for: existing
clients are forcibly disconnected (with rollback of any open
transactions).  If you have clients that will sit on open connections
indefinitely, this is the only way to shut down short of killing the
clients.

Dunno if this option can be passed through your
/etc/rc.d/init.d/postgresql script; the script may need some work.

> That means that I have to use the command "top" to see the other
> postmaster processes and kill them one by one.

As was just pointed out on pghackers, manually killing individual
backends is not merely tedious, it is dangerous.  Avoid it.

            regards, tom lane