PG_CTLCLUSTER(1)
π PG_CTLCLUSTER π
okay so bestie, welcome to pg_ctlcluster(1) β a little Debian PostgreSQL infrastructure icon that runs the whole "start/stop/restart/reload a PostgreSQL cluster" show. she's the group chat moderator of your database clusters and honestly? she ate. πΈ
β¨ NAME β¨
pg_ctlcluster β start/stop/restart/reload a PostgreSQL cluster. no cap, that's literally the whole job description. π
π SYNOPSIS π
pg_ctlcluster [options] cluster-version cluster-name action [-- pg_ctl
options]
where action = start|stop|restart|reload|status|promote|logrotate
that's the whole vibe check. seven actions, one queen. π
π¦ DESCRIPTION π¦
so this program? she controls the postgres server for one specific cluster. think of her as a cute little wrapper around the pg_ctl(1) command β she figures out the cluster version and the data path, then calls the right version of pg_ctl with the appropriate configuration parameters and paths. it's giving personal assistant energy fr fr. π
important tho: you have to run this program as the user who owns the database cluster, or as root. no random third parties allowed, sorry bestie. π
and to make life easier when working with systemd, the alternative syntax "pg_ctlcluster version-cluster action" is also supported β and you can even put the action first (matching the ordering systemctl uses). so many ways to slay. β¨
π ACTIONS π
startβ a log file for this specific cluster gets created if it doesn't exist yet (by default,/var/log/postgresql/postgresql-cluster-version-cluster-name.log), and a PostgreSQL server process (postgres(1)) is started on it. she exits with0on success, with2if the server is already running, and with1on other failure conditions. perfectionist queen. πstopβ stops thepostgres(1)server of the given cluster. by default,"fast"shutdown mode is used. quick, clean, no drama. π¦restartβ stops the server if it's running, and then starts it (again). glow-up moment. β¨reloadβ causes the configuration files to be re-read without a full shutdown of the server. it's giving "no need to make it a whole thing". πΈstatusβ checks whether a server is running. and if it is? the PID and the command line options that were used to invoke it get displayed. receipts, bestie. π§Ύpromoteβ commands a running standby server to exit recovery and begin read-write operations. main character energy, she's stepping up. πlogrotateβ requests that the server of a given cluster rotates the log file. tidy little housekeeping moment. π
β¨ OPTIONS β¨
-f,--forceβ forstopandrestart, the"fast"mode is used, which rolls back all active transactions, disconnects clients immediately, and thus shuts down cleanly. if that doesn't 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 doesn't help, thepostgresprocess is killed π. exits with0on success, with2if the server is not running, and with1on other failure conditions.
okay bestie this mode should only be used when the machine is about to be shut down. like, machine-goes-night-night energy only. no cap.
-m,--mode [smart|fast|immediate]β the shutdown mode to use forstopandrestartactions. default isfast. seepg_ctl(1)for documentation. pick your fighter. π--foregroundβ startpostgresin foreground, without daemonizing viapg_ctl. she stays right there with you. π«Ά--stdlogβ when--foregroundis in use, redirect stderr to the standard logfile in/var/log/postgresql/. (this is the default when not run in foreground.) β--skip-systemctl-redirectβ when running as root,pg_ctlclusterredirects actions tosystemctlso running clusters are properly supervised by systemd. this option skips the redirect; it's used in thepostgresql@.serviceunit file. the redirect is also skipped if additionalpostgresorpg_ctloptions are provided. sneaky little bypass, love that for us. π--bindirdirectory β path topg_ctl. (default is/usr/lib/postgresql/version/bin.) π§-o,--optionsoption β pass the given option as a command line option to thepostgresprocess. it's possible to specify-omultiple times. seepostgres(1)for a description of valid options. stack 'em, bestie. π₯- pg_ctl options β pass the given
pg_ctloptions as command line options topg_ctl. seepg_ctl(1)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 topg_ctl(1). π/etc/postgresql/cluster-version/cluster-name/start.confβ this configuration file controls the start/stop behavior of the cluster. see section"STARTUP CONTROL"inpg_createcluster(8)for details. π¦
π BUGS π
changing the port number on startup using -o -p will not work, because it breaks the checks for running clusters. not me finding out the hard way π. consider yourself warned, bestie.
π SEE ALSO π
pg_createcluster(8), pg_ctl(1), pg_wrapper(1), pg_lsclusters(1), postgres(1)
the whole friend group honestly. go say hi. π
πΈ AUTHOR πΈ
Martin Pitt <mpitt@debian.org> β the icon who made this. π
and that's the page bestie!! this is the Debian PostgreSQL infrastructure version of PG_CTLCLUSTER(1), dated 2026-07-28. periodt. go start a cluster, you absolute legend. π
β¨π
π¦ where this page comes from
- ubuntu stonking: postgresql-common 293ubuntu1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms