'br}

'br}

{\

## NAME

pg_ctlcluster - start/stop/restart/reload a PostgreSQL cluster

## SYNOPSIS

pg_ctlcluster [options] cluster-version cluster-name action -- [pg_ctl options]

where action = start|stop|restart|reload|status|promote

## DESCRIPTION

This program controls the postgres server for a particular cluster. It essentially wraps the pg_ctl|(1) command. It determines the cluster version and data path and calls the right version of pg_ctl with appropriate configuration parameters and paths.

You have to start this program as the user who owns the database cluster or as root.

To ease integration with systemd operation, the alternative syntax "pg_ctlcluster version-cluster action" is also supported.

## ACTIONS

\fBstart\fR 4

A log file for this specific cluster is created if it does not exist yet (by default, f(CW*(C`/var/log/postgresql/postgresql-*(C'cluster-versionf(CW*(C`-*(C'cluster-namef(CW*(C`.log*(C'), and a PostreSQL server process (postgres|(1)) is started on it. Exits with 0 on success, with 2 if the server is already running, and with 1 on other failure conditions.

\fBstop\fR 4

Stops the postgres|(1) server of the given cluster. By default, *(L"smart*(R" shutdown mode is used, which waits until all clients disconnected.

\fBrestart\fR 4

Stops the server if it is running and starts it (again).

\fBreload\fR 4

Causes the configuration files to be re-read without a full shutdown of the server.

\fBstatus\fR 4

Checks whether a server is running. If it is, the s-1PIDs0 and the command line options that were used to invoke it are displayed.

\fBpromote\fR 4

Commands a running standby server to exit recovery and begin read-write operations.

## OPTIONS

\fB-f\fR|\fB--force\fR 4

For stop and restart, the *(L"fast*(R" mode is used which rolls back all active transactions, disconnects clients immediately and thus shuts down cleanly. If that does not work, shutdown is attempted again in *(L"immediate*(R" mode, which can leave the cluster in an inconsistent state and thus will lead to a recovery run at the next start. If this still does not help, the postgres process is killed. Exits with 0 on success, with 2 if the server is not running, and with 1 on other failure conditions. This mode should only be used when the machine is about to be shut down.

\fB-m\fR|\fB--mode\fR [\fBsmart\fR|\fBfast\fR|\fBimmediate\fR] 4

Shutdown mode to use for stop and restart actions, default is smart. See pg_ctl|(1) for documentation.

\fB--foreground\fR 4

Start postgres in foreground, without daemonizing via pg_ctl.

\fB--stdlog\fR 4

When --foreground is in use, redirect stderr to the standard logfile in f(CW*(C`/var/log/postgresql/*(C'. (Default when not run in foreground.)

\fB-o\fR|\fB--options\fR \fIoption\fR 4

Pass given option as command line option to the f(CW*(C`postgres*(C' process. It is possible to specify -o multiple times. See postgres|(1) for a description of valid options.

\fIpg_ctl options\fR 4

Pass given pg_ctl options as command line options to pg_ctl. See pg_ctl|(1) for a description of valid options.

## FILES

This configuration file contains cluster specific options to be passed to pg_ctl|(1).

This configuration file controls the start/stop behavior of the cluster. See section *(L"s-1STARTUP CONTROL*(R"s0 in pg_createcluster|(8) for details.

## BUGS

Changing the port number on startup using -o -p will not work as it breaks the checks for running clusters.

## SEE ALSO

pg_createcluster|(8), pg_ctl|(1), pg_wrapper|(1), pg_lsclusters|(1), postgres|(1)

## AUTHOR

Martin Pitt <mpitt@debian.org>