---
name: "pg_ctlcluster"
section: "1"
platform: "linux"
package: "postgresql-common"
version: "278"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/pg_ctlcluster"
---

# pg\_ctlcluster(1)

start/stop/restart/reload a PostgreSQL cluster

## 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**\|**logrotate**

## DESCRIPTION

This program controls the **postgres** server for a particular cluster. It essentially wraps the [**pg\_ctl**(1)](/pg_ctl/1.md) 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, as well as putting the action first (matching the ordering used by **systemctl**).

## ACTIONS

- **start**

  A log file for this specific cluster is created if it does not exist yet (by default, `/var/log/postgresql/postgresql-`*cluster-version*`-`*cluster-name*`.log`), and a PostgreSQL server process ([**postgres**(1)](/postgres/1.md)) is started on it. Exits with 0 on success, with 2 if the server is already running, and with 1 on other failure conditions.

- **stop**

  Stops the [**postgres**(1)](/postgres/1.md) server of the given cluster. By default, "fast" shutdown mode is used.

- **restart**

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

- **reload**

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

- **status**

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

- **promote**

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

- **logrotate**

  Requests that the server of a given cluster rotates the log file.

## OPTIONS

- **-f**\|**--force**

  For **stop** and **restart**, the "fast" 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 "immediate" 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.

- **-m**\|**--mode** \[**smart**\|**fast**\|**immediate**\]

  Shutdown mode to use for **stop** and **restart** actions, default is **fast**. See [**pg\_ctl**(1)](/pg_ctl/1.md) for documentation.

- **--foreground**

  Start **postgres** in foreground, without daemonizing via **pg\_ctl**.

- **--stdlog**

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

- **--skip-systemctl-redirect**

  When running as root, **pg\_ctlcluster** redirects actions to **systemctl** so running clusters are properly supervised by **systemd**. This option skips the redirect; it is used in the **postgresql@.service** unit file. The redirect is also skipped if additional **postgres** or **pg\_ctl** options are provided.

- **--bindir** *directory*

  Path to **pg\_ctl**.  (Default is `/usr/lib/postgresql/`*version*`/bin`.)

- **-o**\|**--options** *option*

  Pass given *option* as command line option to the `postgres` process. It is possible to specify **-o** multiple times. See [**postgres**(1)](/postgres/1.md) for a description of valid options.

- *pg\_ctl options*

  Pass given *pg\_ctl options* as command line options to **pg\_ctl**. See [**pg\_ctl**(1)](/pg_ctl/1.md) for a description of valid options.

## FILES

- /etc/postgresql/*cluster-version*/*cluster-name*/pg\_ctl.conf

  This configuration file contains cluster specific options to be passed to [**pg\_ctl**(1)](/pg_ctl/1.md).

- /etc/postgresql/*cluster-version*/*cluster-name*/start.conf

  This configuration file controls the start/stop behavior of the cluster. See section "STARTUP CONTROL" in [**pg\_createcluster**(8)](/pg_createcluster/8.md) 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_createcluster/8.md), [**pg\_ctl**(1)](/pg_ctl/1.md), [**pg\_wrapper**(1)](/pg_wrapper/1.md), [**pg\_lsclusters**(1)](/pg_lsclusters/1.md), [**postgres**(1)](/postgres/1.md)

## AUTHOR

Martin Pitt \<mpitt@debian.org\>
