This section describes the process for converting a standalone PostgreSQL instance into a Patroni cluster.
To deploy a Patroni cluster without using a pre-existing PostgreSQL instance, see Running and Configuring instead.
A Patroni cluster can be started with a data directory from a single-node PostgreSQL database. This is achieved by following closely these steps:
- Manually start PostgreSQL daemon
- Create Patroni superuser and replication users as defined in the authentication section of the Patroni configuration. If this user is created in SQL, the following queries achieve this:
Start Patroni (e.g.
patroni /etc/patroni/patroni.yml). It automatically detects that PostgreSQL daemon is already running but its configuration might be out-of-date.
Ask Patroni to restart the node with
patronictl restart cluster-name node-name.
- During Patroni startup, Patroni complains that it cannot bind to the PostgreSQL port.
You need to verify
. Don’t forget that
should allow such access.
After asking Patroni to restart the node, PostgreSQL displays the error message
could not open configuration file "/etc/postgresql/10/main/pg_hba.conf": No such file or directory
It can mean various things depending on how you manage PostgreSQL configuration. If you specified
, Patroni generates the
based on the settings in the
section only when it bootstraps a new cluster. In this scenario the
was not empty, therefore no bootstrap happened. This file must exist beforehand.