Installation
Source: https://patroni.readthedocs.io/en/latest/installation.html
Pre-requirements for Mac OS
On a Mac, install the requirements:
Psycopg
Since psycopg2-2.8, the binary package is not installed by default. A source installation requires a C compiler and Postgres and Python development packages. Python dependencies cannot express psycopg2 OR psycopg2-binary. Select an installation method:
- Use the package manager from your distro
- Specify one of
psycopg,psycopg2, orpsycopg2-binaryin the list of dependencies when installing Patroni with pip.
General installation for pip
Patroni can be installed with pip:
Leave dependencies empty, or specify one or more of these dependencies:
etcd or etcd3python-etcd module to use Etcd as the Distributed Configuration Store (DCS)
consulpy-consul module to use Consul as the DCS
zookeeperkazoo module to use Zookeeper as the DCS
exhibitorkazoo module to use Exhibitor as the DCS (same dependencies as Zookeeper)
kubernetes
kubernetes module to use Kubernetes as the DCS
raftpysyncobj module to use the Python Raft implementation as the DCS
awsboto3 to use AWS callbacks
jsonloggerpython-json-logger module for JSON logging
systemdsystemd-python for sd_notify integration
all
all of the above (except psycopg family)
psycopg3psycopg\[binary\]\>=3.0.0 module
psycopg2psycopg2\>=2.5.4 module
psycopg2-binarypsycopg2-binary module
For example, install Patroni with psycopg3, Etcd DCS dependencies, and AWS callbacks:
Install external tools, such as WAL-E, separately if your replica creation or custom bootstrap scripts call them.
Package installation on Linux
The Postgres community may provide Patroni packages for these operating systems:
- RHEL, RockyLinux, AlmaLinux;
- Debian and Ubuntu;
- SUSE Enterprise Linux.
Packages may also provide direct dependencies, such as Python modules absent from the operating system repositories.
For more information see the PGDG repository documentation.
On RedHat Enterprise Linux derivatives, you may also need EPEL packages. See the EPEL repository documentation.
After you configure the PGDG repository for your operating system, install Patroni.
The Postgres community maintains these packages, rather than the Patroni developers. For support, first contact Postgres slack.
Installing on Debian derivatives
After you configure the PGDG repository, install Patroni with apt:
Installing on RedHat derivatives
On RHEL 9 and derivatives, first configure the PGDG repository. Then install Patroni with an etcd DCS:
If your RedHat derivative does not provide etcd packages, install them from PGDG. On each DCS node, run:
For RHEL 8, replace the version with 8 to use pgdg-rhel8-extras. RockyLinux, AlmaLinux, Oracle Linux, and other derivatives also use the pgdg-rhelN-extras repository name.
Installing on SUSE Enterprise Linux
Some dependencies may require SUSE PackageHub repositories. See the SUSE PackageHub documentation.
On SLES 15, configure the PGDG repository. Then install Patroni:
With the SUSE PackageHub repo enabled you can also install etcd:
Upgrading
To upgrade Patroni, update the software and restart the Patroni daemon on each cluster node.
A Patroni daemon restart also restarts the Postgres database. This can cause primary failover. We recommend maintenance mode until all Patroni daemon restarts finish.
On one Patroni node, put the cluster in maintenance mode:
Then on each node in the cluster, perform the package upgrade required for your OS:
Restart the patroni daemon process on each node:
Resume Patroni monitoring and leave maintenance mode:
The cluster now operates fully with the new Patroni version.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)