patroni/debian
Michael Banck 941e358015 Setting distribution to unreleased 2023-02-17 09:34:22 +01:00
..
patches * debian/patches/regression_tests_skip_citus_test.patch: New patch, skips 2023-01-31 09:23:08 +01:00
source Initial import of patroni packaging version 1.3.4-1 2017-09-14 14:55:13 +02:00
tests * debian/tests/control: Add procps as dependency and skip DCS failsafe mode 2023-01-30 22:47:40 +01:00
README.Debian * debian/README.Debian: Add note about rewind user. 2020-08-30 14:15:48 +02:00
changelog Setting distribution to unreleased 2023-02-17 09:34:22 +01:00
clean debian/clean: Remove patroni.egg-info/. 2021-12-14 11:23:02 +01:00
compat Fix systemd integration 2018-02-07 10:41:56 +01:00
config.yml * debian/config.yml, debian/dcs.yml: Update example consul configuration, 2020-06-03 16:07:37 +02:00
config.yml.in * debian/config.yml.in: Update configuration: 2022-02-18 22:15:57 +01:00
control * debian/control (Uploaders): Updated. 2023-02-17 09:33:41 +01:00
copyright Initial import of patroni packaging version 1.3.4-1 2017-09-14 14:55:13 +02:00
dcs.yml * debian/config.yml, debian/dcs.yml: Update example consul configuration, 2020-06-03 16:07:37 +02:00
design.md * debian/design.md: Add note to curren station section 2018-10-22 19:54:52 +02:00
gitlab-ci.yml Use shared gitlab-ci.yml file from postgresql-common. 2018-12-08 14:10:02 +01:00
patroni-doc.install * debian/control (patroni-doc): New package. 2018-10-26 12:27:16 +01:00
patroni.dirs Add debian/patroni.dirs file forgotten in 75a8d4b6 2018-10-22 13:19:40 +02:00
patroni.docs * debian/control (patroni-doc): New package. 2018-10-26 12:27:16 +01:00
patroni.examples Initial import of patroni packaging version 1.3.4-1 2017-09-14 14:55:13 +02:00
patroni.install * debian/patches/startup_scripts.patch: Split out patroni@.service into ... 2018-11-11 15:23:27 +01:00
patroni@.service patroni@.service: Remove redundant (and broken) WorkingDirectory. Thanks Ludovic Gasc! 2021-10-15 14:58:49 +02:00
pg_clonecluster_patroni * debian/pg_clonecluster_patroni: Remove postgresql.base.conf before running 2021-01-22 11:20:27 +01:00
pg_createcluster_patroni * debian/pg_createcluster_patroni: Pass $DATADIR variable to pg_createcluster 2020-05-07 12:29:43 +02:00
pg_createconfig_patroni * debian/config.yml.in: Make base data directory a template variable 2021-01-22 10:09:46 +01:00
py3dist-overrides debian/py3dist-overrides: Tell dh_python3 to find "ipaddress" in python3 >= 3.3. 2021-12-14 11:27:33 +01:00
rules * debian/control (patroni-doc): New package. 2018-10-26 12:27:16 +01:00
watch * debian/watch: Fixed. 2017-09-20 15:55:59 +02:00

README.Debian

Patroni for Debian
------------------

The Debian patroni package has been adjusted in order to interoperate with
Debian's postgresql-common (pg-common) framework for the administration of
PostgreSQL instances.  A particular pg-common instance (or cluster) is
identified by the PostgreSQL major version (e.g. 10) and the cluster name
(e.g. `main' as the default cluster), i.e. `10/main' or `10-main'.

Automatic Patroni configuration generation
------------------------------------------

The Debian patroni package provides the pg_createconfig_patroni program that
allows one to create a Patroni configuration for the desired Debian pg-common
cluster, e.g. /etc/patroni/10-main for the `10/main' or `10-main' cluster,
similar to pg_createcluster:

 # pg_createconfig_patroni 10 main

The configuration is assembled from the /etc/patroni/dcs.yml fragment for the
DCS configuration (see below) and a generic /etc/patroni/config.yml.in.  The
cluster-specific variables are substituted from config.yml.in into the specific
instance configuration file.

Distributed Consensus Store (DCS)
---------------------------------

A DCS needs to be configured and this is out-of-scope for the patroni package.
The DCS-specific parts of the Patroni configuration can be configured in
/etc/patroni/dcs.yml and will get integrated by pg_createconfig_patroni.

Patroni service
---------------

Similar to the postgresql@ service, a patroni@ service unit is provided that
allows the administration of an arbitrary pg-common cluster without having to
define a systemd unit for each cluster, e.g.:

 # systemctl start patroni@10-main

Due to systemd limitations, the cluster definition has to be provided with a `-'
not a `/' between version and cluster name.

Note that due to Patron insisting on managing the Postgres server, the
corresponding systemd service (postgresql@10-main) cannot be used anymore.  It
is possible to reload the Postgres configuration via `pg_ctlcluster 10 main
reload', though.

Integration of vip-manager
--------------------------

The vip-manager package allows to expose a virtual ip (VIP) for the leader node
by monitoring the leader key in the DCS and setting or removing the configured
VIP for the local node depending on leader status.

The Debian vip-manager package provides a /etc/patroni/vip.in template which
can be used to write a vip-manager configuration for a patroni cluster via
the --vip option:

 # pg_createconfig_patroni --vip=10.0.1.1 10 main

Similarly to the patroni package, the vip-manager service can then be started
via a systemd unit specific for the cluster:

 # systemctl start vip-manager@10-main

Cluster Bootstrap
-----------------

After Patroni is started on a node for a particular cluster, it tried to acquire
the leader lock in the DCS.  If it can acquire the lock, it will be the master of
the cluster and bootstrap the instance. The pg_createconfig_patroni-generated
configuration defines a custom bootstrap via the pg_createcluster_patroni
script, which is a shell wrapper around the usual pg_createcluster utility.

The standby nodes cannot be bootstrapped this way, as the cluster id is
unique and Patroni expects a single cluster id among all members.  To this end,
the pg_clonecluster_patroni shell script is provided, which sets up a cluster
and then clones from the master node via pg_basebackup.

pg_hba.conf
-----------

In order to have the identical pg_hba.conf on each cluster node, the default
pg_hba.conf gets overwritten by the lines specified in the
bootstrap.dcs.postgresql section of the Patroni configuration. By default,
replication connections from the local network and regular password (md5) based
connections from localhost are allowed.

pg_rewind and postgres password
-------------------------------

By default, no postgres database password is set; i.e. the postgres superuser
can only connect via the local socket.  Likewise, pg_rewind is disabled (as
pg_rewind requires remote superuser access) and Patroni will re-clone a former
primary if its timeline has diverged from the cluster.

If pg_rewind is to be used, then the `bootstrap.use_pg_rewind' parameter in
/etc/patroni/config.yml.in needs to be set to `true' and either the
`postgresql.authentication.superuser.password' parameter needs to be set to the
desired postgres password or (for PostgreSQL versions 11 and up) the
`postgresql.authenticaion.rewind.{user,password}` needs to be set.  If the
`rewind` user is set, Patroni will grant it the necessary rights to run
pg_rewind without superuser privileges. Finally, password (md5) connections
need to be allowed on the local network.