Skip to content

How to promote a slave to the master. Postgresql

To switch slave to the master mode:

Find out the path to the directory

postgres=# show data_directory;
     data_directory
------------------------
 /storage/postgresql/db
(1 row)

Add this path to the environment variable

export PGDATA="/storage/postgresql/db"

And promote the base to the master mode

/usr/lib/postgresql/13/bin/pg_ctl promote