1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-21 05:21:08 +03:00

Add cluster_name GUC which is included in process titles if set.

When running several postgres clusters on one OS instance it's often
inconveniently hard to identify which "postgres" process belongs to
which postgres instance.

Add the cluster_name GUC, whose value will be included as part of the
process titles if set. With that processes can more easily identified
using tools like 'ps'.

To avoid problems with encoding mismatches between postgresql.conf,
consoles, and individual databases replace non-ASCII chars in the name
with question marks. The length is limited to NAMEDATALEN to make it
less likely to truncate important information at the end of the
status.

Thomas Munro, with some adjustments by me and review by a host of people.
This commit is contained in:
Andres Freund
2014-06-29 14:15:09 +02:00
parent a6d488cb53
commit 51adcaa0df
6 changed files with 86 additions and 7 deletions

View File

@@ -4131,6 +4131,29 @@ local0.* /var/log/postgresql
</listitem>
</varlistentry>
<varlistentry id="guc-cluster-name" xreflabel="cluster_name">
<term><varname>cluster_name</varname> (<type>string</type>)</term>
<indexterm>
<primary><varname>cluster_name</> configuration parameter</primary>
</indexterm>
<listitem>
<para>
Sets the cluster name that appears in the process title for all
processes in this cluster. The name can be any string of less than
<symbol>NAMEDATALEN</> characters (64 characters in a standard
build). Only printable ASCII characters may be used in the
<varname>application_name</varname> value. Other characters will be
replaced with question marks (<literal>?</literal>). No name is shown
if this parameter is set to the empty string <literal>''</> (which is
the default). This parameter can only be set at server start.
</para>
<para>
The process title is typically viewed using programs like
<application>ps</> or, on Windows, <application>Process Explorer</>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>debug_print_parse</varname> (<type>boolean</type>)
<indexterm>

View File

@@ -91,6 +91,22 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
system view to determine who is blocking whom.)
</para>
<para>
If <xref linkend="guc-cluster-name"> has been configured the
cluster name will also be show in <command>ps</> output:
<screen>
$ psql -c 'SHOW cluster_name'
cluster_name
--------------
server1
(1 row)
$ ps aux|grep server1
postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: server1: writer process
...
</screen>
</para>
<para>
If you have turned off <xref linkend="guc-update-process-title"> then the
activity indicator is not updated; the process title is set only once