Re: Cluster name in ps output

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: Thomas Munro <munro(at)ip9(dot)org>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Cluster name in ps output
Date: 2014-05-05 10:53:23
Message-ID: 53676DA3.4010304@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 05/05/2014 06:00 PM, Thomas Munro wrote:
> Hi
>
> When running more than one cluster I often find myself looking at
> the output of 'iotop' or other tools wondering which
> cluster's "wal receiver process" or "checkpointer process" etc
> I'm seeing. Obviously it's easy enough to find out (for example
> by looking at a tree view in htop/ps that shows the -D parameter
> of the parent postmaster), but I thought it could be useful to be
> able to give a name to the cluster and include it in the ps
> output. Here is a strawman patch that does that.
>
> If cluster_name is not set, it defaults to the empty string and
> the ps output is unchanged. If it's set to 'foox' the ps output
> includes that string in square brackets:
>
> postgres: [foox] checkpointer process
> postgres: [foox] writer process
> postgres: [foox] wal writer process
> postgres: [foox] autovacuum launcher process
> postgres: [foox] stats collector process
> postgres: [foox] munro foodb [local] idle

I'd find something like that very useful.

I'd even be tempted to tack on the port number, though that might be
overkill.

Perhaps just use the port number instead of a new cluster name? Most
people won't use/set something like a cluster name, though I guess
distros that use pg_wrapper would probably auto-set it via pg_wrapper's
configuration.

Personally I'd find:

postgres[5433]: checkpointer process

at least as useful. The only time that's not unique is in a BSD jail or
lxc container, and in those cases IIRC ps can show you the
jail/container anyway.

Showing the port would help new-ish users a lot; many seem to be very
confused by which PostgreSQL instance(s) they're connecting to and which
are running. Especially on Mac OS X, where people often land up with
Apple's PostgreSQL, Homebrew, Postgres.app, and who knows what else
running at the same time.

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2014-05-05 10:54:21 Re: Cluster name in ps output
Previous Message Thomas Munro 2014-05-05 10:49:19 Re: Cluster name in ps output