OnCallReady

Commands

pg_createcluster - create a new PostgreSQL cluster (postgresql-common)

pg_createcluster [OPTIONS] <version> <cluster name> [-- <initdb options>]

Options you will use

-p, --port=PORT
port for the new cluster.
-d, --datadir=DIR
data directory (default /var/lib/postgresql/<version>/<cluster>).
-u, --user=USER
cluster owner (default postgres).
--start
start the cluster after creating it.
--start-conf=auto|manual|disabled
start.conf value.
-e, --encoding=ENCODING
database encoding.
--locale=LOCALE
locale for the new cluster.

Examples

$ sudo pg_createcluster 18 replica -p 5433

a second cluster on port 5433

$ sudo pg_createcluster 18 pitr -d /var/lib/postgresql/18/pitr -p 5433

adopt a restored data directory

Taught in

Try pg_createcluster in a real terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.