This is the multi-page printable view of this section. .
Patroni configuration
- 1: Dynamic Configuration Settings
- 2: YAML Configuration Settings
- 3: Environment Configuration Settings
Source: https://patroni.readthedocs.io/en/latest/patroni_configuration.html
There are 3 types of Patroni configuration:
Global dynamic configuration.
These options are stored in the DCS (Distributed Configuration Store) and apply to all nodes. Change them at any time with patronictl_edit_config or the REST API. Changes outside startup configuration apply asynchronously on each node’s next wake-up cycle, followed by a reload. Changed PostgreSQL parameters with postmaster context require a restart. Patroni setspending_restartin members.data JSON for these nodes. Node status also shows"restart_pending": true.Local configuration file (patroni.yml).
Local options override dynamic configuration. To reloadpatroni.ymlwithout restarting Patroni, send SIGHUP, sendPOST /reload, or run patronictl_reload. Local configuration can be one YAML file or a directory. Patroni loads all YAML files in a directory in sorted order. If several files define a key, the last file takes precedence.Environment configuration.
Environment variables can set or override some local parameters. Use them in dynamic environments where some values are unknown in advance. For example, the external IP address may be unknown insidedocker.
Important rules
PostgreSQL parameters controlled by Patroni
These PostgreSQL parameters must have the same values on the primary and replicas. Local configuration and environment values have no effect. Set them through shared DCS configuration. The list shows their defaults and minimum values:
- max_connections: default value 100, minimal value 25
- max_locks_per_transaction: default value 64, minimal value 32
- max_worker_processes: default value 8, minimal value 2
- max_prepared_transactions: default value 0, minimal value 0
- wal_level: default value hot_standby, accepted values: hot_standby, replica, logical
- track_commit_timestamp: default value off
PostgreSQL permits different primary and replica values for the parameters below. However, a replica can become primary at any time. Different values are therefore unsuitable, and Patroni permits changes only through dynamic configuration.
- max_wal_senders: default value 10, minimal value 3
- max_replication_slots: default value 10, minimal value 4
- wal_keep_segments: default value 8, minimal value 1
- wal_keep_size: default value 128MB, minimal value 16MB
- wal_log_hints: on
Patroni validates these values for correctness or a required minimum.
There are some other Postgres parameters controlled by Patroni:
- listen_addresses - is set either from
postgresql.listenor fromPATRONI_POSTGRESQL_LISTENenvironment variable - port - is set either from
postgresql.listenor fromPATRONI_POSTGRESQL_LISTENenvironment variable - cluster_name - is set either from
scopeor fromPATRONI_SCOPEenvironment variable - hot_standby: on
Patroni writes the parameters above to postgresql.conf. Except for wal_keep_segments and wal_keep_size, it also passes them as postgres arguments. These arguments take precedence over all other settings, including ALTER SYSTEM.
Parameters such as postgresql.listen and postgresql.data_dir can only be set locally. Use the configuration file or environment variables. Local configuration overrides dynamic configuration in most cases.
When applying the local or dynamic configuration options, the following actions are taken:
- The node checks for
postgresql.base.confandcustom_conf. - If
custom_confis set, its file supplies the base configuration. Patroni ignorespostgresql.base.confandpostgresql.confas base files. - Otherwise, an existing
postgresql.base.confsupplies the base configuration. It contains the renamed original configuration. - If neither exists, Patroni renames the original
postgresql.conftopostgresql.base.confand uses it as the base. - Patroni writes dynamic options to
postgresql.conf, subject to the exceptions above. It adds an include forpostgresql.base.confor thecustom_conffile. New options can then apply without rereading the file to check for the include. - Command-line arguments override parameters essential for Patroni cluster management.
- If a changed value requires restart according to pg_settings context, Patroni sets pending_restart on the node. Any restart resets this flag.
The parameters would be applied in the following order (run-time are given the highest priority):
- load parameters from file
postgresql.base.conf(or from acustom_conffile, if set) - load parameters from file
postgresql.conf - load parameters from file
postgresql.auto.conf - run-time parameter using
-o --name=value
This order supports shared node configuration (2) and node-specific ALTER SYSTEM settings (3). It enforces essential Patroni parameters (4). It also permits external tools to manage the base configuration directly (1).
PostgreSQL parameters that touch shared memory
PostgreSQL has some parameters that determine the size of the shared memory used by them:
- max_connections
- max_prepared_transactions
- max_locks_per_transaction
- max_wal_senders
- max_worker_processes
Changes require a PostgreSQL restart. Standby shared memory structures must not be smaller than the corresponding primary structures.
Change these values through dynamic configuration, as Patroni requires. The usual sequence is:
- Applying changes through patronictl_edit_config (or via REST API
/configendpoint) - Restarting nodes through patronictl_restart (or via REST API
/restartendpoint)
Note: Restart PostgreSQL through patronictl_restart or the REST API /restart endpoint. Restarting the Patroni daemon with systemctl restart patroni can trigger failover if the node is primary.
These shared memory settings require a specific restart order:
If you want to increase the value of any of those settings:
- Restart all standbys first
- Restart the primary after that
If you want to decrease the value of any of those settings:
- Restart the primary first
- Restart all standbys after that
Note: If you restart all nodes together after a decrease, Patroni restarts standbys with the original value. You must restart them again later. This prevents an endless crash loop: PostgreSQL exits with FATAL if a value is below that recorded in standby pg_controldata. A standby value can decrease only after its pg_controldata reflects the primary change.
More information about that can be found at PostgreSQL Administrator’s Overview.
Patroni configuration parameters
Also the following Patroni configuration options can be changed only dynamically:
- ttl: 30
- loop_wait: 10
- retry_timeout: 10
- maximum_lag_on_failover: 1048576
- max_timelines_history: 0
- check_timeline: false
- postgresql.use_slots: true
After a change, Patroni reads the relevant DCS configuration section and updates its runtime values.
After each configuration change, Patroni writes DCS options to patroni.dynamic.json in the Postgres data directory. Only the leader can restore these options from disk. It can do so only when DCS options are absent or invalid.
Configuration generation and validation
The patroni executable can generate and validate local configuration. Use it to:
- Create a sample local Patroni configuration;
- Create a Patroni configuration file for the locally running PostgreSQL instance (e.g. as a preparation step for the Patroni integration);
- Validate a given Patroni configuration file.
Sample Patroni configuration
Description
Generate a sample Patroni configuration in yaml format. Values come from Environment configuration. For unset parameters, use Patroni defaults or #FIXME for values that the user must supply.
Some default values are defined based on the local setup:
- postgresql.listen: the IP address returned by
gethostnamecall for the current machine’s hostname and the standard5432port.- postgresql.connect_address: the IP address returned by
gethostnamecall for the current machine’s hostname and the standard5432port.- postgresql.authentication.rewind: is only defined if the PostgreSQL version can be defined from the binary and the version is 11 or later.
- restapi.listen: IP address returned by
gethostnamecall for the current machine’s hostname and the standard8008port.- restapi.connect_address: IP address returned by
gethostnamecall for the current machine’s hostname and the standard8008port.
Parameters
configfile - full path to the configuration file used to store the result. If not provided, the result is sent to stdout.
Patroni configuration for a running instance
Description
Generate a yaml configuration for the local running PostgreSQL instance. Connection settings use the supplied DSN first, then PostgreSQL environment variables. If no password is supplied, enter it at the prompt.
All non-internal GUCs from the source instance supply these Patroni parameters. This includes GUCs set through files, postmaster command-line arguments, or environment variables:
- scope:
cluster_nameGUC value;- postgresql.listen:
listen_addressesandportGUC values;- postgresql.datadir:
data_directoryGUC value;- postgresql.parameters:
archive_command,restore_command,archive_cleanup_command,recovery_end_command,ssl_passphrase_command,hba_file,ident_file,config_fileGUC values;- bootstrap.dcs: all other gathered PostgreSQL GUCs.
If Postgres GUCs do not supply scope, postgresql.listen, or postgresql.datadir, Patroni uses the corresponding Environment configuration value.
Other rules applied for the values definition:
- name:
PATRONI_NAMEenvironment variable value if set, otherwise the current machine’s hostname.- postgresql.bin_dir: path to the Postgres binaries gathered from the running instance.
- postgresql.connect_address: the IP address returned by
gethostnamecall for the current machine’s hostname and the port used for the instance connection or theportGUC value.- postgresql.authentication.superuser: the configuration used for the instance connection;
- postgresql.pg_hba: the lines gathered from the source instance’s
hba_file.- postgresql.pg_ident: the lines gathered from the source instance’s
ident_file.- restapi.listen: IP address returned by
gethostnamecall for the current machine’s hostname and the standard8008port.- restapi.connect_address: IP address returned by
gethostnamecall for the current machine’s hostname and the standard8008port.
The generated file also includes other parameters from Environment configuration.
Parameters
configfile
Full path to the configuration file used to store the result. If not provided, result is sent to stdout.
dsn
Optional DSN string for the local PostgreSQL instance to get GUC values from.
Validate Patroni configuration
Description
Validate the Patroni configuration and print failed checks.
Parameters
configfile
Full path to the file to check. If absent or nonexistent, read PATRONI_CONFIG_VARIABLE. If that variable is unset, use Patroni environment variables.
--ignore-listen-port | -i
Optional flag to ignore bind failures for occupied listen ports during configfile validation.
--print | -p
Optional flag to print local configuration, including environment overrides, after successful validation.
1 - Dynamic Configuration Settings
Source: https://patroni.readthedocs.io/en/latest/dynamic_configuration.html
Dynamic configuration is stored in the DCS (Distributed Configuration Store) and applied on all cluster nodes.
Change dynamic configuration with patronictl_edit_config or the Patroni REST API.
- loop_wait: the number of seconds the loop will sleep. Default value: 10, minimum possible value: 1
- ttl: leader lock TTL, in seconds. This is the interval before automatic failover can start. Default: 30. Minimum: 20.
- retry_timeout: timeout for DCS and PostgreSQL operation retries (in seconds). DCS or network issues shorter than this will not cause Patroni to demote the leader. Default value: 10, minimum possible value: 3
when changing values of loop_wait, retry_timeout, or ttl you have to follow the rule:
- maximum_lag_on_failover: the maximum bytes a follower may lag to be able to participate in leader election.
- primary_race_backoff: delays standby leader races by
primary_race_backoffseconds while WAL replication from the primary advances. This reduces unnecessary failovers when Patroni is briefly unresponsive. Default: 0 (disabled). - maximum_lag_on_syncnode: maximum synchronous replica lag in bytes before replacement by a healthy asynchronous replica. With multiple replicas, Patroni uses the maximum replica LSN. Otherwise, it uses the leader’s current WAL LSN. Default: -1. Values of 0 or less disable replacement. Use a sufficiently high value to avoid frequent replacements during high transaction volume.
- max_timelines_history: maximum number of timeline history items kept in DCS. Default value: 0. When set to 0, it keeps the full history in DCS.
- primary_start_timeout: seconds allowed for primary recovery before failover. Default: 300. A value of 0 permits immediate failover after crash detection. Asynchronous failover can lose transactions. Worst-case failover time is loop_wait + primary_start_timeout + loop_wait, or only loop_wait when primary_start_timeout is zero. Select the value for your durability and availability requirements.
- primary_stop_timeout: seconds Patroni can wait for Postgres shutdown when synchronous_mode is enabled. With synchronous_mode enabled and a value > 0, Patroni sends SIGKILL to postmaster if shutdown exceeds this interval. Select the value for your durability and availability requirements. Unset values or values <= 0 disable this timeout.
- synchronous_mode: synchronous replication mode:
off,on, orquorum. The leader managessynchronous_standby_names. Only the last known leader or synchronous replicas can enter a leader race. This protects successful commits during failover but can block writes when Patroni cannot guarantee durability. See replication modes documentation. - synchronous_mode_strict: keeps synchronous replication enabled when no synchronous replica is available, blocking client writes. Without an eligible streaming replica, Patroni uses the last synchronous nodes from
/syncforsynchronous_standby_names. If no prior state exists, it uses__patroni_strict_sync_replica_placeholder__. Do not use that reserved value for the nodenameinpatroni.yaml. See replication modes documentation. - synchronous_node_count: required synchronous standby count when synchronous_mode is enabled. Patroni updates the DCS and PostgreSQL
synchronous_standby_namesas members join or leave. It reduces the count if it exceeds the number of eligible nodes. Default:1. - failsafe_mode: Enables DCS Failsafe Mode. Defaults to
false. - postgresql:
- use_pg_rewind: enables pg_rewind. Default:
false. For correct operation,pg_rewindrequiresdata page checksumsand/orwal_log_hintsset toon. Enable checksums with the--data-checksumsoption forinitdb. - use_slots: whether or not to use replication slots. Defaults to
trueon PostgreSQL 9.4+. - recovery_conf: extra recovery.conf settings for replicas. PostgreSQL 12 no longer uses recovery.conf. You can still use this section because Patroni handles the version difference.
- parameters: configuration parameters (GUCs) for Postgres in format
{max_connections: 100, wal_level: "replica", max_wal_senders: 10, wal_log_hints: "on"}. Many of these are required for replication to work. - parameters_primary: (optional) role-specific parameter overrides for primary. These values are merged with and override the base parameters.
- parameters_replica: (optional) role-specific parameter overrides for replica. These values are merged with and override the base parameters.
- parameters_standby_leader: (optional) role-specific parameter overrides for standby_leader. These values are merged with and override the base parameters.
- pg_hba: list of lines that Patroni will use to generate
pg_hba.conf. Patroni ignores this parameter ifhba_filePostgreSQL parameter is set to a non-default value.- - host all all 0.0.0.0/0 md5
- - host replication replicator 127.0.0.1/32 md5: A line like this is required for replication.
- pg_hba_primary: (optional) role-specific pg_hba entries for primary. These completely replace pg_hba (no merging). If not defined, pg_hba is used.
- pg_hba_replica: (optional) role-specific pg_hba entries for replica. These completely replace pg_hba (no merging). If not defined, pg_hba is used.
- pg_hba_standby_leader: (optional) role-specific pg_hba entries for standby_leader. These completely replace pg_hba (no merging). If not defined, pg_hba is used.
- pg_ident: list of lines that Patroni will use to generate
pg_ident.conf. Patroni ignores this parameter ifident_filePostgreSQL parameter is set to a non-default value.- - mapname1 systemname1 pguser1
- - mapname1 systemname2 pguser2
- pg_ident_primary: (optional) role-specific pg_ident entries for primary. These completely replace pg_ident (no merging). If not defined, pg_ident is used.
- pg_ident_replica: (optional) role-specific pg_ident entries for replica. These completely replace pg_ident (no merging). If not defined, pg_ident is used.
- pg_ident_standby_leader: (optional) role-specific pg_ident entries for standby_leader. These completely replace pg_ident (no merging). If not defined, pg_ident is used.
- use_pg_rewind: enables pg_rewind. Default:
- standby_cluster: if this section is defined, we want to bootstrap a standby cluster.
- host: an address of remote node
- port: a port of remote node
- primary_slot_name: replication slot on the remote node. Optional. The default comes from the instance name; see
slot_name_from_member_name. - create_replica_methods: ordered methods to bootstrap the standby leader from the remote primary. This list can differ from postgresql_settings.
- restore_command: command to restore remote primary WAL records to standby cluster nodes. It can differ from postgresql_settings.
- archive_cleanup_command: cleanup command for standby leader
- recovery_min_apply_delay: how long to wait before actually apply WAL records on a standby leader
- member_slots_ttl: physical slot retention after replicas shut down. Default:
30min. A value of0restores immediate removal when the member key expires from the DCS. Requires PostgreSQL 11 or later. - slots: permanent replication slots, retained through switchover and failover. Patroni creates missing slots. On PostgreSQL 11 and later, it creates physical slots on all nodes and advances them every loop_wait seconds. Earlier versions maintain permanent physical slots only on the primary. Logical slots are copied from the primary to a standby with restart. Their positions then advance every loop_wait seconds if necessary. Patroni copies logical slot files through
libpqwith rewind or superuser credentials; see postgresql.authentication. A replica slot can lag behind the old primary. Applications must handle repeated messages after failover, for example by trackingconfirmed_flush_lsn. Permanent slots require postgresql.use_slots set totrue. Permanent logical slots automatically enablehot_standby_feedback. Logical slot failover is unsafe on PostgreSQL 9.6 and older, and PostgreSQL 10 lacks required functions. This feature requires PostgreSQL 11+.- my_slot_name: permanent slot name. Patroni does not create a slot on the node with the same name. A permanent physical slot named after a member remains even when that member becomes unresponsive. Normally, Patroni would remove it. This preserves member slots during temporary failures or migration to Patroni; see Convert a Standalone to a Patroni Cluster. Remove these matching names from DCS configuration when the slots are no longer required. Otherwise, they affect normal Patroni operation.
- type:
physicalorlogical. Logical slots also requiredatabaseandplugin. Physical slots optionally acceptcluster_type. - database: the database name where logical slots should be created.
- plugin: the plugin name for the logical slot.
- cluster_type: create the slot only on this cluster type:
primaryorstandby. On other types, Patroni skips creation or drops an existing slot.
- type:
- my_slot_name: permanent slot name. Patroni does not create a slot on the node with the same name. A permanent physical slot named after a member remains even when that member becomes unresponsive. Normally, Patroni would remove it. This preserves member slots during temporary failures or migration to Patroni; see Convert a Standalone to a Patroni Cluster. Remove these matching names from DCS configuration when the slots are no longer required. Otherwise, they affect normal Patroni operation.
- ignore_slots: sets of slot properties that Patroni must ignore. Use this for slots managed outside Patroni. Any matching subset of properties causes a slot to be ignored.
- name: the name of the replication slot.
- type: slot type. Can be
physicalorlogical. If the slot is logical, you may additionally definedatabaseand/orplugin. - database: the database name (when matching a
logicalslot). - plugin: the logical decoding plugin (when matching a
logicalslot).
Note: slots is a hashmap while ignore_slots is an array. For example:
Note: On PostgreSQL v11 or later, Patroni maintains physical slots on all nodes eligible to become leader. Replicas therefore retain WAL segments that other nodes may need. After an absent node’s DCS member key expires, Patroni drops its slot after member_slots_ttl, which defaults to 30min. Adjust retention for your requirements.
For a fixed topology with stable node names, you can configure permanent physical slots named after the nodes. This prevents slot removal and WAL recycling while a replica is temporarily down:
Permanent slots synchronize only from primary/standby_leader to replicas. Applications must therefore use them only on the leader. Using them on replicas causes indefinite pg_wal growth on all other nodes. Physical slots named after Patroni members are an exception. Patroni creates and synchronizes these slots across all nodes for member replication.
The nostream tag disables permanent logical slot copying and synchronization on a standby and all its cascading replicas.
2 - YAML Configuration Settings
Source: https://patroni.readthedocs.io/en/latest/yaml_configuration.html
Global/Universal
- thread_pool_size: thread pool size for asynchronous tasks and REST API communication with other members during leader races or failsafe checks. Minimum:
5. Default:5. - thread_stack_size: stack size for Patroni threads. Use a multiple of
64kB. Minimum:64kB. Patroni default:512kB. - name: the name of the host. Must be unique for the cluster. The value
__patroni_strict_sync_replica_placeholder__is reserved for internal use by Patroni and cannot be used as a node name. - namespace: path within the configuration store where Patroni will keep information about the cluster. Default value: “/service”
- scope: cluster name
Log
- type: sets the format of logs. Can be either plain or json. To use json format, you must have the jsonlogger installed. The default value is plain.
- level: sets the general logging level. Default value is INFO (see the docs for Python logging)
- traceback_level: sets the level where tracebacks will be visible. Default value is ERROR. Set it to DEBUG if you want to see tracebacks only if you enable log.level=DEBUG.
- format: log format. For plain logs, use a string. For json, use a string or a list of LogRecord attributes. In lists, use field names without %( and ). To rename a field, use a dictionary with the original field as key and the output name as value. Default: %(asctime)s %(levelname)s: %(message)s.
- dateformat: sets the datetime formatting string. (see the formatTime() documentation)
- static_fields: add additional fields to the log. This option is only available when the log type is set to json.
- max_queue_size: maximum internal log queue size. Patroni writes records to an in-memory queue. A separate thread reads them and writes to stderr or a file. The default 1000 records retain approximately 1h20m of logs.
- dir: application log directory. It must exist and be writable by the Patroni user. By default, Patroni retains four 25MB files. Adjust retention with
file_numandfile_size. - mode: Permissions for log files (for example,
0644). If not specified, permissions will be set based on the current umask value. - file_num: The number of application logs to retain.
- file_size: Size of patroni.log file (in bytes) that triggers a log rolling.
- loggers: This section allows redefining logging level per python module
- patroni.postmaster: WARNING
- urllib3: DEBUG
- deduplicate_heartbeat_logs: suppresses consecutive identical heartbeat messages when
true. Default:false.
HA loop timing helps diagnose failovers caused by exhausted resources and similar problems. With deduplicate_heartbeat_logs set to true, loop execution produces no log unless the leader changes. These diagnostics are then unavailable in the logs.
For JSON logging, use this example:
Bootstrap configuration
After initial cluster bootstrap, Patroni stores settings in the DCS. Later changes to YAML bootstrap.dcs have no effect. Use patronictl_edit_config or the REST API to change them.
- bootstrap:
dcs: global dynamic cluster configuration. Put parameters from Dynamic Configuration settings under
bootstrap.dcs. After bootstrap, Patroni writes this section to /<namespace>/<scope>/config in the configuration store.method: custom script to use for bootstrapping this cluster.
See custom bootstrap methods. Set
methodtoinitdb, or omit it, to use the defaultinitdbcommand.initdb: (optional) list options to be passed on to initdb.
- - data-checksums: Must be enabled when pg_rewind is needed on 9.3.
- - encoding: UTF8: default encoding for new databases.
- - locale: UTF8: default locale for new databases.
post_bootstrap or post_init: script to run after cluster initialization. It receives a connection URL with the cluster superuser name. PGPASSFILE points to the pgpass file.
Citus
Enable Citus integration. Patroni then registers workers on the coordinator. See Citus support.
- group: the Citus group id, integer. Use
0for coordinator and1,2, etc… for workers - database: database for the citus extension. Use the same database on the coordinator and all workers. Currently, only one database is supported.
Consul
Most of the parameters are optional, but you have to specify one of the host or url
- host: the host:port for the Consul local agent.
- url: url for the Consul local agent, in format: http(s)://host:port.
- port: (optional) Consul port.
- scheme: (optional) http or https, defaults to http.
- token: (optional) ACL token.
- verify: (optional) whether to verify the SSL certificate for HTTPS requests.
- cacert: (optional) The ca certificate. If present it will enable validation.
- cert: (optional) file with the client certificate.
- key: (optional) file with the client key. Can be empty if the key is part of cert.
- dc: (optional) Datacenter to communicate with. By default the datacenter of the host is used.
- consistency: (optional) Select consul consistency mode. Possible values are
default,consistent, orstale(more details in consul API reference) - checks: (optional) list of Consul health checks used for the session. By default an empty list is used.
- register_service: (optional) registers a service named by scope. Its role tag is master, primary, replica, or standby-leader. Default: false.
- service_tags: (optional) additional static tags to add to the Consul service apart from the role (
primary/replica/standby-leader). By default an empty list is used. - service_check_interval: (optional) how often to perform health check against registered url. Defaults to ‘5s’.
- service_check_tls_server_name: (optional) override SNI host when connecting via TLS, see also consul agent check API reference.
The token needs to have the following ACL permissions:
service_prefix "${scope}" {
policy = "write"
}
key_prefix "${namespace}/${scope}" {
policy = "write"
}
session_prefix "" {
policy = "write"
}
Etcd
Most of the parameters are optional, but you have to specify one of the host, hosts, url, proxy or srv
- host: the host:port for the etcd endpoint.
- hosts: list of etcd endpoint in format host1:port1,host2:port2,etc… Could be a comma separated string or an actual yaml list.
- use_proxies: if true, treats hosts as proxies. Patroni does not discover etcd topology.
- url: url for the etcd.
- proxy: proxy url for the etcd. If you are connecting to the etcd using proxy, use this parameter instead of url.
- srv: domain for SRV-based cluster discovery. Patroni queries these services in order until one succeeds:
_etcd-client-ssl,_etcd-client,_etcd-ssl,_etcd,_etcd-server-ssl,_etcd-server. For_etcd-server-sslor_etcd-server, it queries available members through the ETCD peer protocol. Otherwise, it uses hosts from the SRV records. - srv_suffix: suffix for discovery SRV names. Requires srv. Use it to distinguish etcd clusters in one domain. For example,
srv_suffix: fooandsrv: example.orgproduce_etcd-client-ssl-foo._tcp.example.com. Patroni applies this suffix to each possible ETCD SRV service name. - protocol: (optional) http or https, if not specified http is used. If the url or proxy is specified - will take protocol from them.
- username: (optional) username for etcd authentication.
- password: (optional) password for etcd authentication.
- cacert: (optional) The ca certificate. If present it will enable validation.
- cert: (optional) file with the client certificate.
- key: (optional) file with the client key. Can be empty if the key is part of cert.
Etcdv3
To use Etcd protocol version 3, configure the etcd3 section. Its parameters are the same as etcd.
Protocol versions 2 and 3 cannot see each other’s keys. Changing Patroni configuration alone cannot migrate etcd to etcd3. Patroni uses the Etcd gRPC-gateway proxy for the V3 API. This prevents TLS common name authentication.
ZooKeeper
- hosts: List of ZooKeeper cluster members in format: .
- use_ssl: (optional) Whether SSL is used or not. Defaults to
false. If set tofalse, all SSL specific parameters are ignored. - cacert: (optional) The CA certificate. If present it will enable validation.
- cert: (optional) File with the client certificate.
- key: (optional) File with the client key.
- key_password: (optional) The client key password.
- verify: (optional) Whether to verify certificate or not. Defaults to
true. - set_acls: (optional) default ACL that Kazoo applies to each new ZNode. Use
x509(default) or another supported ZooKeeper scheme, such asdigest. Supply a dictionary: each key is the full principal, optionally prefixed with its scheme. Each value lists one or more permissions:CREATE,READ,WRITE,DELETE,ADMIN, orALL. Example:set_acls: {CN=principal1: [CREATE, READ], digest:principal2:+pjROuBuuwNNSujKyH8dGcEnFPQ=: [ALL]}. - auth_data: (optional) connection authentication dictionary. Use
schemeas the key andcredentialas the value. Default: empty dictionary.
It is required to install kazoo>=2.6.0 to support SSL.
Exhibitor
- hosts: initial list of Exhibitor (ZooKeeper) nodes in format: ‘host1,host2,etc…’. This list updates automatically whenever the Exhibitor (ZooKeeper) cluster topology changes.
- poll_interval: how often the list of ZooKeeper and Exhibitor nodes should be updated from Exhibitor.
- port: Exhibitor port.
Kubernetes
- bypass_api_service: (optional) normally, Patroni contacts the kubernetes service at
KUBERNETES_SERVICE_HOST. Withbypass_api_serviceset totrue, it discovers the API nodes behind the service and contacts them directly. - namespace: (optional) Kubernetes namespace where Patroni pod is running. Default value is
default. - labels: labels in
{label1: value1, label2: value2}format. Patroni uses them to find cluster Pods and Endpoints or ConfigMaps. It also adds them to each Endpoint or ConfigMap it creates. - scope_label: (optional) name of the label containing cluster name. Default value is
cluster-name. - bootstrap_labels: (optional) labels in
{label1: value1, label2: value2}format. Patroni assigns them to pods in these states:initializing new cluster,running custom bootstrap script,starting after custom bootstrap, orcreating replica. - role_label: (optional) name of the label containing role (
primary,replica, or other custom value). Patroni will set this label on the pod it runs in. Default value isrole. - leader_label_value: (optional) value of the pod label when Postgres role is
primary. Default value isprimary. - follower_label_value: (optional) value of the pod label when Postgres role is
replica. Default value isreplica. - standby_leader_label_value: (optional) value of the pod label when Postgres role is
standby_leader. Default value isprimary. - tmp_role_label: (optional) name of the temporary label containing role (
primaryorreplica). Value of this label will always use the default of corresponding role. Set only when necessary. - use_endpoints: (optional) if set to true, Patroni will use Endpoints instead of ConfigMaps to run leader elections and keep cluster state.
- pod_ip: (optional) Patroni pod IP address. Required when
use_endpointsis enabled. On promotion, Patroni uses this value to populate leader endpoint subsets. - ports: (optional) named Service ports require identical Endpoint port names. Otherwise, the service cannot work. For
{Kind: Service, spec: {ports: [{name: postgresql, port: 5432, targetPort: 5432}]}}, setkubernetes.ports: [{"name": "postgresql", "port": 5432}]. Patroni uses this value to update leader Endpoint subsets. Applies only withkubernetes.use_endpoints. - cacert: (optional) CA_BUNDLE file with trusted CA certificates for Kubernetes API SSL verification. Defaults to the ServiceAccount secret value.
- retriable_http_codes: (optional) Kubernetes API status codes to retry. By default, Patroni retries
500,503, and504, and responses with aretry-afterHTTP header.
Raft (deprecated)
self_addr:
ip:portto listen on for Raft connections. Theself_addrmust be accessible from other nodes of the cluster. If not set, the node will not participate in consensus.bind_addr: (optional)
ip:portto listen on for Raft connections. If not specified theself_addrwill be used.partner_addrs: list of other Patroni nodes in the cluster in format:
data_dir: directory where to store Raft log and snapshot. If not specified the current working directory is used.
password: (optional) Encrypt Raft traffic with a specified password, requires
cryptographypython module.min_timeout: (optional) minimum election timeout in seconds for the underlying pysyncobj Raft implementation. Must be greater than 3 *
append_entries_period. Default:0.4.max_timeout: (optional) maximum election timeout in seconds for the underlying pysyncobj Raft implementation. Must be greater than
min_timeout. Default:1.4.connection_timeout: (optional) time in seconds after which a connection with no data received is considered dead. Must be greater than or equal to
max_timeout. Default:3.5.append_entries_period: (optional) interval in seconds for sending heartbeat (append_entries) commands. Must be less than one-third of
min_timeout. Default:0.1.connection_retry_time: (optional) interval in seconds between reconnection attempts to offline nodes. Default:
5.0.leader_fallback_timeout: (optional) time in seconds after which a leader with no response from the majority falls back to follower state. Must be greater than
append_entries_period. Default:30.0.
Adjust these timeouts for high-latency networks where pysyncobj defaults are too short. Required constraints: min_timeout > 3 * append_entries_period, max_timeout > min_timeout, connection_timeout >= max_timeout, and leader_fallback_timeout > append_entries_period. Patroni validates them at startup and refuses to start if they fail. Changes require a restart.
[!WARNING]
These settings only extend pysyncobj election and connection timeouts. Each Raft command, including leader lock refresh and cluster-state writes, must still finish within retry_timeout (default 10). With round-trip latency above approximately a few seconds, a command can exceed this limit even if connection_timeout exceeds the RTT. The DCS then appears unreachable, and the primary may demote. Also increase retry_timeout and ttl on these links. Keep loop_wait + 2 * retry_timeout <= ttl.
Short FAQ about Raft implementation
Q: How to list all the nodes providing consensus?
A:
syncobj_admin -conn host:port -statuswhere the host:port is the address of one of the cluster nodesQ: Node that was a part of consensus and has gone and I can’t reuse the same IP for other node. How to remove this node from the consensus?
A:
syncobj_admin -conn host:port -remove host2:port2where thehost2:port2is the address of the node you want to remove from consensus.Q: Where to get the
syncobj_adminutility?A: It is installed together with
pysyncobjmodule (python RAFT implementation), which is Patroni dependency.Q: it is possible to run Patroni node without adding in to the consensus?
A: Yes, just comment out or remove
raft.self_addrfrom Patroni configuration.Q: It is possible to run Patroni and PostgreSQL only on two nodes?
A: Yes, on the third node you can run
patroni_raft_controller(without Patroni and PostgreSQL). In such a setup, one can temporarily lose one node without affecting the primary.
PostgreSQL
- postgresql:
authentication:
- superuser:
- username: name for the superuser, set during initialization (initdb) and later used by Patroni to connect to the postgres.
- password: password for the superuser, set during initialization (initdb).
- sslmode: (optional) maps to sslmode. Specifies the TLS negotiation mode. See the PostgreSQL documentation for each mode. Default:
prefer. - sslkey: (optional) maps to sslkey. Path to the secret key for the client certificate.
- sslpassword: (optional) maps to sslpassword. Password for the secret key in
sslkey. - sslcert: (optional) maps to sslcert. Path to the client certificate.
- sslrootcert: (optional) maps to sslrootcert. File containing one or more trusted CA certificates. The client uses them to verify the server certificate.
- sslcrl: (optional) maps to sslcrl. Certificate revocation list file. The client rejects servers whose certificates appear in the list.
- sslcrldir: (optional) maps to sslcrldir. Directory containing certificate revocation list files. The client rejects servers whose certificates appear in these lists.
- sslnegotiation: (optional) maps to sslnegotiation. Controls server SSL negotiation when SSL is used.
- gssencmode: (optional) maps to gssencmode. Controls whether to negotiate secure GSS TCP/IP and its priority.
- channel_binding: (optional) maps to channel_binding. Controls client channel binding.
- replication:
- username: replication username; the user will be created during initialization. Replicas will use this user to access the replication source via streaming replication
- password: replication password; the user will be created during initialization.
- sslmode: (optional) maps to sslmode. Specifies the TLS negotiation mode. See the PostgreSQL documentation for each mode. Default:
prefer. - sslkey: (optional) maps to sslkey. Path to the secret key for the client certificate.
- sslpassword: (optional) maps to sslpassword. Password for the secret key in
sslkey. - sslcert: (optional) maps to sslcert. Path to the client certificate.
- sslrootcert: (optional) maps to sslrootcert. File containing one or more trusted CA certificates. The client uses them to verify the server certificate.
- sslcrl: (optional) maps to sslcrl. Certificate revocation list file. The client rejects servers whose certificates appear in the list.
- sslcrldir: (optional) maps to sslcrldir. Directory containing certificate revocation list files. The client rejects servers whose certificates appear in these lists.
- sslnegotiation: (optional) maps to sslnegotiation. Controls server SSL negotiation when SSL is used.
- gssencmode: (optional) maps to gssencmode. Controls whether to negotiate secure GSS TCP/IP and its priority.
- channel_binding: (optional) maps to channel_binding. Controls client channel binding.
- rewind:
- username: (optional) name for the user for
pg_rewind; the user will be created during initialization of postgres 11+ and all necessary permissions will be granted. - password: (optional) password for the user for
pg_rewind; the user will be created during initialization. - sslmode: (optional) maps to sslmode. Specifies the TLS negotiation mode. See the PostgreSQL documentation for each mode. Default:
prefer. - sslkey: (optional) maps to sslkey. Path to the secret key for the client certificate.
- sslpassword: (optional) maps to sslpassword. Password for the secret key in
sslkey. - sslcert: (optional) maps to sslcert. Path to the client certificate.
- sslrootcert: (optional) maps to sslrootcert. File containing one or more trusted CA certificates. The client uses them to verify the server certificate.
- sslcrl: (optional) maps to sslcrl. Certificate revocation list file. The client rejects servers whose certificates appear in the list.
- sslcrldir: (optional) maps to sslcrldir. Directory containing certificate revocation list files. The client rejects servers whose certificates appear in these lists.
- sslnegotiation: (optional) maps to sslnegotiation. Controls server SSL negotiation when SSL is used.
- gssencmode: (optional) maps to gssencmode. Controls whether to negotiate secure GSS TCP/IP and its priority.
- channel_binding: (optional) maps to channel_binding. Controls client channel binding.
- username: (optional) name for the user for
- superuser:
callbacks: callback scripts to run on certain actions. Patroni will pass the action, role and cluster name. (See scripts/aws.py as an example of how to write them.)
- on_reload: run this script when configuration reload is triggered.
- on_restart: run this script when the postgres restarts (without changing role).
- on_role_change: run this script when the postgres is being promoted or demoted.
- on_start: run this script when the postgres starts.
- on_stop: run this script when the postgres stops.
connect_address: IP address + port through which Postgres is accessible from other nodes and applications.
proxy_address: address and port of the connection pool beside Postgres, such as pgbouncer. Patroni stores it as
proxy_urlin the DCS member key for service discovery.create_replica_methods: ordered methods for creating replicas. The default is “basebackup”. Other methods refer to scripts, each with its own configuration section. See custom replica creation methods.
data_dir: The location of the Postgres data directory, either existing or to be initialized by Patroni.
config_dir: The location of the Postgres configuration directory, defaults to the data directory. Must be writable by Patroni.
bin_dir: (optional) Path to PostgreSQL binaries (pg_ctl, initdb, pg_controldata, pg_basebackup, postgres, pg_isready, pg_rewind). If not provided or is an empty string, PATH environment variable will be used to find the executables.
bin_name: (optional) Make it possible to override Postgres binary names, if you are using a custom Postgres distribution:
- pg_ctl: (optional) Custom name for
pg_ctlbinary. - initdb: (optional) Custom name for
initdbbinary. - pgcontroldata: (optional) Custom name for
pg_controldatabinary. - pg_basebackup: (optional) Custom name for
pg_basebackupbinary. - postgres: (optional) Custom name for
postgresbinary. - pg_isready: (optional) Custom name for
pg_isreadybinary. - pg_rewind: (optional) Custom name for
pg_rewindbinary.
- pg_ctl: (optional) Custom name for
listen: Postgres listen addresses and port. With streaming replication, other cluster nodes must be able to reach this address. Separate multiple addresses with commas and append the port after the last address:
listen: 127.0.0.1,127.0.0.2:5432. Patroni uses the first address for local connections.use_unix_socket: prefer Unix sockets for cluster connections. Default:
false. Ifunix_socket_directoriesis set, use its first suitable value, or TCP if none is suitable. If absent frompostgresql.parameters, assume the default socket directory and omithostfrom connection parameters.use_unix_socket_repl: prefer Unix sockets for replication user connections. Default:
false. Ifunix_socket_directoriesis set, use its first suitable value, or TCP if none is suitable. If absent frompostgresql.parameters, assume the default socket directory and omithostfrom connection parameters.pgpass: path to the .pgpass password file. Patroni creates this file before executing pg_basebackup, the post_init script and under some other circumstances. The location must be writable by Patroni.
recovery_conf: additional configuration settings written to recovery.conf when configuring follower.
custom_conf : optional custom
postgresql.conffile to use instead ofpostgresql.base.conf. It must exist on all nodes and be readable by PostgreSQL. The actualpostgresql.confincludes it from its location. Patroni neither monitors nor backs up this file. Patroni configuration can still override its settings; see dynamic configuration.parameters: configuration parameters (GUCs) for Postgres in format
{ssl: "on", ssl_cert_file: "cert_file"}.parameters_primary: (optional) role-specific parameter overrides for primary. These values are merged with and override the base parameters.
parameters_replica: (optional) role-specific parameter overrides for replica. These values are merged with and override the base parameters.
parameters_standby_leader: (optional) role-specific parameter overrides for standby_leader. These values are merged with and override the base parameters.
pg_hba: list of lines that Patroni will use to generate
pg_hba.conf. Patroni ignores this parameter ifhba_filePostgreSQL parameter is set to a non-default value. Together with dynamic configuration this parameter simplifies management ofpg_hba.conf.- - host all all 0.0.0.0/0 md5
- - host replication replicator 127.0.0.1/32 md5: A line like this is required for replication.
pg_hba_primary: (optional) role-specific pg_hba entries for primary. These completely replace pg_hba (no merging). If not defined, pg_hba is used.
pg_hba_replica: (optional) role-specific pg_hba entries for replica. These completely replace pg_hba (no merging). If not defined, pg_hba is used.
pg_hba_standby_leader: (optional) role-specific pg_hba entries for standby_leader. These completely replace pg_hba (no merging). If not defined, pg_hba is used.
pg_ident: list of lines that Patroni will use to generate
pg_ident.conf. Patroni ignores this parameter ifident_filePostgreSQL parameter is set to a non-default value. Together with dynamic configuration this parameter simplifies management ofpg_ident.conf.- - mapname1 systemname1 pguser1
- - mapname1 systemname2 pguser2
pg_ident_primary: (optional) role-specific pg_ident entries for primary. These completely replace pg_ident (no merging). If not defined, pg_ident is used.
pg_ident_replica: (optional) role-specific pg_ident entries for replica. These completely replace pg_ident (no merging). If not defined, pg_ident is used.
pg_ident_standby_leader: (optional) role-specific pg_ident entries for standby_leader. These completely replace pg_ident (no merging). If not defined, pg_ident is used.
pg_ctl_timeout: How long should pg_ctl wait when doing
start,stoporrestart. Default value is 60 seconds.use_pg_rewind: try pg_rewind when the old leader rejoins as a replica. For correct operation,
pg_rewindrequiresdata page checksumsand/orwal_log_hintsset toon. Enable checksums with the--data-checksumsoption forinitdb.rewind: (optional) custom options to pass to the
pg_rewindcommand. Can be specified as a list of strings and/or single key-value dictionaries. Not allowed options include:target-pgdata,source-pgdata,source-server,write-recovery-conf,dry-run,restore-target-wal,config-file,no-ensure-shutdown,version, andhelp. Example usage:remove_data_directory_on_rewind_failure: If this option is enabled, Patroni will remove the PostgreSQL data directory and recreate the replica. Otherwise it will try to follow the new leader. Default value is false.
remove_data_directory_on_diverged_timelines: remove the data directory and recreate the replica if timelines diverge and the old primary cannot stream from the new primary. Use this when
pg_rewindis unavailable. On PostgreSQL v10 and older, Patroni checks divergence by connecting to the “postgres” database with replication credentials. Permit this access in pg_hba.conf. Default: false.replica_method: add a section for each create_replica_methods entry other than basebackup. Use the method name as the section name. At minimum, set “command” to the full script path. Patroni passes other parameters to the script as “parameter=value”.
pre_promote: fencing script run after leader lock acquisition and before replica promotion during failover. A non-zero exit prevents promotion and removes the DCS leader key.
before_stop: script run immediately before Postgres stops. It runs synchronously and blocks shutdown until completion. Shutdown then proceeds regardless of its exit code.
REST API
- restapi:
- thread_pool_size: size of thread pool used by Patroni to process REST API requests. Minimal value is
5, default value is5. - connect_address: address or host name and port for the REST API. Every cluster member must reach it. Use a non-loopback address except for a local demonstration; “localhost” and “127.0.0.1” are unsuitable for other deployments. It supports HTTP health checks, user queries, and member checks during leader elections. These checks determine whether the leader runs or another node has a later WAL position. Patroni stores connect_address in the DCS member key so member names resolve to REST API addresses.
- listen: address or host name and port for REST API health checks and communication between cluster members. HAProxy and other load balancers can use HTTP “OPTION” or “GET” checks.
- authentication: (optional)
- username: Basic-auth username to protect unsafe REST API endpoints.
- password: Basic-auth password to protect unsafe REST API endpoints.
- certfile: (optional): Specifies the file with the certificate in the PEM format. If the certfile is not specified or is left empty, the API server will work without SSL.
- keyfile: (optional): Specifies the file with the secret key in the PEM format.
- keyfile_password: (optional): Specifies a password for decrypting the keyfile.
- cafile: (optional): Specifies the file with the CA_BUNDLE with certificates of trusted CAs to use while verifying client certs.
- ciphers: (optional): Specifies the permitted cipher suites (e.g. “ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-GCM-SHA256:!SSLv1:!SSLv2:!SSLv3:!TLSv1:!TLSv1.1”)
- verify_client: (optional) client certificate verification mode:
none(default),optional, orrequired.nonedisables verification.requiredrequires certificates for all calls; successful signature verification authenticates the client.optionalrequires and checks certificates only for unsafePUT,POST,PATCH, andDELETErequests. - allowlist: (optional) hosts permitted to call unsafe endpoints. Each entry can be a host name, IP address, or CIDR network. Default:
allow all. Withallowlistorallowlist_include_membersset, all unlisted sources are rejected. - allowlist_include_members: (optional) if
true, permits unsafe endpoint access from cluster members registered in the DCS. It uses each member’sapi_urlhost name or IP address. The operating system may use a different address for outgoing connections. - http_extra_headers: (optional): HTTP headers let the REST API server pass additional information with an HTTP response.
- https_extra_headers: (optional): HTTPS headers let the REST API server pass additional information with an HTTP response when TLS is enabled. This will also pass additional information set in
http_extra_headers. - request_queue_size: (optional): Sets request queue size for TCP socket used by Patroni REST API. Once the queue is full, further requests get a “Connection denied” error. The default value is 5.
- server_tokens: (optional): Configures the value of the
ServerHTTP header.Minimal: The header will contain only the Patroni version, e.g.Patroni/4.0.0.ProductOnly: The header will contain only the product name, e.g.Patroni.Original(default): The header will expose the original behaviour and display the BaseHTTP and Python versions, e.g.BaseHTTP/0.6 Python/3.12.3.
- thread_pool_size: size of thread pool used by Patroni to process REST API requests. Minimal value is
Here is an example of both http_extra_headers and https_extra_headers:
Warning
- The
restapi.connect_addressmust be accessible from all nodes of a given Patroni cluster. Internally Patroni is using it during the leader race to find nodes with minimal replication lag. - If you enabled client certificates validation (
restapi.verify_clientis set torequired), you also must provide valid client certificates in thectl.certfile,ctl.keyfile,ctl.keyfile_password. If not provided, Patroni will not work correctly.
CTL
- ctl: (optional)
- authentication:
- username: Basic-auth username for accessing protected REST API endpoints. If not provided patronictl will use the value provided for REST API “username” parameter.
- password: Basic-auth password for accessing protected REST API endpoints. If not provided patronictl will use the value provided for REST API “password” parameter.
- insecure: Allow connections to REST API without verifying SSL certs.
- cacert: CA_BUNDLE file or directory with trusted CAs for REST API SSL verification. If absent, patronictl uses the REST API “cafile” value.
- certfile: Specifies the file with the client certificate in the PEM format.
- keyfile: Specifies the file with the client secret key in the PEM format.
- keyfile_password: Specifies a password for decrypting the client keyfile.
- authentication:
Watchdog
- mode:
off,automatic, orrequired.offdisables the watchdog.automaticuses it when available and otherwise ignores it.requiredprevents leadership unless watchdog activation succeeds. - device: Path to watchdog device. Defaults to
/dev/watchdog. - safety_margin: Number of seconds of safety margin between watchdog triggering and leader key expiration.
Tags
- clonefrom:
trueorfalse. Iftrue, other nodes may prefer this node as their bootstrappg_basebackupsource. With multiple nodes taggedclonefrom, selection is random. Default:false. - noloadbalance:
trueorfalse. If set totruethe node will return HTTP Status Code 503 for theGET /replicaREST API health-check and therefore will be excluded from the load-balancing. Defaults tofalse. - replicatefrom: The name of another replica to replicate from. Used to support cascading replication.
- nosync:
trueorfalse. If set totruethe node will never be selected as a synchronous replica. - sync_priority: integer priority for synchronous standby selection with synchronous_mode set to
on. Higher values are preferred. Values of 0 or less exclude the node fromsynchronous_standby_names, likenosync: true. This is the opposite ofsync_priorityinpg_stat_replication. - nofailover:
trueorfalse, controls whether this node is allowed to participate in the leader race and become a leader. Defaults tofalse, meaning this node can_ participate in leader races. - failover_priority: integer failover priority. Higher values are preferred when nodes have received/replayed the same WAL amount. A higher receive/replay LSN takes precedence over priority. Values of 0 or less prevent leader election participation and promotion, like
nofailover: true. Currently,failover_prioritydoes not work with quorum-based synchronous replication. - nostream:
trueorfalse. Iftrue, disable WAL streaming through the replication protocol. Use archive recovery, ifrestore_commandis configured, andpg_wal/pg_xlogpolling instead. Also disable permanent logical slot copying and synchronization on this node and its cascading replicas. This tag has no effect on a primary.
Provide only one of nofailover or failover_priority. Providing nofailover: true is the same as failover_priority: 0, and providing nofailover: false will give the node priority 1.
In addition to these predefined tags, you can also add your own ones:
- key1:
true - key2:
false - key3:
1.4 - key4:
"RandomString"
Tags appear in the REST API and patronictl_list. Use them in instance health checks. An undefined tag or a value different from the query value returns HTTP 503.
3 - Environment Configuration Settings
Source: https://patroni.readthedocs.io/en/latest/ENVIRONMENT.html
System environment variables can override some Patroni configuration file parameters. This page lists all supported variables. Environment values always take precedence over file values.
Global/Universal
- PATRONI_CONFIGURATION: sets the complete Patroni configuration through PATRONI_CONFIGURATION. Patroni then ignores all other environment variables.
- PATRONI_THREAD_POOL_SIZE: thread pool size for asynchronous tasks and REST API communication with other members during leader races or failsafe checks. Minimum:
5. Default:5. - PATRONI_THREAD_STACK_SIZE: stack size for Patroni threads. Use a multiple of
64kB. Minimum:64kB. Patroni default:512kB. - PATRONI_NAME: name of the node where the current instance of Patroni is running. Must be unique for the cluster. The value
__patroni_strict_sync_replica_placeholder__is reserved for internal use by Patroni and cannot be used as a node name. - PATRONI_NAMESPACE: path within the configuration store where Patroni will keep information about the cluster. Default value: “/service”
- PATRONI_SCOPE: cluster name
- PG_MALLOC_ARENA_MAX: custom value for
MALLOC_ARENA_MAXenvironment variable forpostmasterprocess. If not set,postmasterwill inheritMALLOC_ARENA_MAXvalue.
Log
- PATRONI_LOG_TYPE: sets the format of logs. Can be either plain or json. To use json format, you must have the jsonlogger installed. The default value is plain.
- PATRONI_LOG_LEVEL: sets the general logging level. Default value is INFO (see the docs for Python logging)
- PATRONI_LOG_TRACEBACK_LEVEL: sets the level where tracebacks will be visible. Default value is ERROR. Set it to DEBUG if you want to see tracebacks only if you enable PATRONI_LOG_LEVEL=DEBUG.
- PATRONI_LOG_FORMAT: log format. For plain logs, use a string. For json, use a string or a list of LogRecord attributes. In lists, use field names without %( and ). To rename a field, use a dictionary with the original field as key and the output name as value. Default: %(asctime)s %(levelname)s: %(message)s.
- PATRONI_LOG_DATEFORMAT: sets the datetime formatting string. (see the formatTime() documentation)
- PATRONI_LOG_STATIC_FIELDS: add additional fields to the log. This option is only available when the log type is set to json. Example
PATRONI_LOG_STATIC_FIELDS="{app: patroni}" - PATRONI_LOG_MAX_QUEUE_SIZE: maximum internal log queue size. Patroni writes records to an in-memory queue. A separate thread reads them and writes to stderr or a file. The default 1000 records retain approximately 1h20m of logs.
- PATRONI_LOG_DIR: application log directory. It must exist and be writable by the Patroni user. By default, Patroni retains four 25MB files. Adjust retention with
PATRONI_LOG_FILE_NUMandPATRONI_LOG_FILE_SIZE. - PATRONI_LOG_MODE: Permissions for log files (for example,
0644). If not specified, permissions will be set based on the current umask value. - PATRONI_LOG_FILE_NUM: The number of application logs to retain.
- PATRONI_LOG_FILE_SIZE: Size of patroni.log file (in bytes) that triggers a log rolling.
- PATRONI_LOG_LOGGERS: Redefine logging level per python module. Example
PATRONI_LOG_LOGGERS="{patroni.postmaster: WARNING, urllib3: DEBUG}" - PATRONI_LOG_DEDUPLICATE_HEARTBEAT_LOGS: suppresses consecutive identical heartbeat messages when
true. Default:false.
HA loop timing helps diagnose failovers caused by exhausted resources and similar problems. With PATRONI_LOG_DEDUPLICATE_HEARTBEAT_LOGS set to true, loop execution produces no log unless the leader changes. These diagnostics are then unavailable in the logs.
Citus
Enable Citus integration. Patroni then registers workers on the coordinator. See Citus support.
- PATRONI_CITUS_GROUP: the Citus group id, integer. Use
0for coordinator and1,2, etc… for workers - PATRONI_CITUS_DATABASE: database for the citus extension. Use the same database on the coordinator and all workers. Currently, only one database is supported.
Consul
- PATRONI_CONSUL_HOST: the host:port for the Consul local agent.
- PATRONI_CONSUL_URL: url for the Consul local agent, in format: http(s)://host:port
- PATRONI_CONSUL_PORT: (optional) Consul port
- PATRONI_CONSUL_SCHEME: (optional) http or https, defaults to http
- PATRONI_CONSUL_TOKEN: (optional) ACL token
- PATRONI_CONSUL_VERIFY: (optional) whether to verify the SSL certificate for HTTPS requests
- PATRONI_CONSUL_CACERT: (optional) The ca certificate. If present it will enable validation.
- PATRONI_CONSUL_CERT: (optional) File with the client certificate
- PATRONI_CONSUL_KEY: (optional) File with the client key. Can be empty if the key is part of certificate.
- PATRONI_CONSUL_DC: (optional) Datacenter to communicate with. By default the datacenter of the host is used.
- PATRONI_CONSUL_CONSISTENCY: (optional) Select consul consistency mode. Possible values are
default,consistent, orstale(more details in consul API reference) - PATRONI_CONSUL_CHECKS: (optional) list of Consul health checks used for the session. By default an empty list is used.
- PATRONI_CONSUL_REGISTER_SERVICE: (optional) registers a service named by scope. Its role tag is master, primary, replica, or standby-leader. Default: false.
- PATRONI_CONSUL_SERVICE_TAGS: (optional) additional static tags to add to the Consul service apart from the role (
primary/replica/standby-leader). By default an empty list is used. - PATRONI_CONSUL_SERVICE_CHECK_INTERVAL: (optional) how often to perform health check against registered url
- PATRONI_CONSUL_SERVICE_CHECK_TLS_SERVER_NAME: (optional) override SNI host when connecting via TLS, see also consul agent check API reference.
Etcd
- PATRONI_ETCD_PROXY: proxy url for the etcd. If you are connecting to the etcd using proxy, use this parameter instead of PATRONI_ETCD_URL
- PATRONI_ETCD_URL: url for the etcd, in format: http(s)://(username:password@)host:port
- PATRONI_ETCD_HOSTS: list of etcd endpoints in format ‘host1:port1’,‘host2:port2’,etc…
- PATRONI_ETCD_USE_PROXIES: if true, treats hosts as a fixed proxy list. Patroni does not discover etcd topology.
- PATRONI_ETCD_PROTOCOL: http or https, if not specified http is used. If the url or proxy is specified - will take protocol from them.
- PATRONI_ETCD_HOST: the host:port for the etcd endpoint.
- PATRONI_ETCD_SRV: domain for SRV-based cluster discovery. Patroni queries these services in order until one succeeds:
_etcd-client-ssl,_etcd-client,_etcd-ssl,_etcd,_etcd-server-ssl,_etcd-server. For_etcd-server-sslor_etcd-server, it queries available members through the ETCD peer protocol. Otherwise, it uses hosts from the SRV records. - PATRONI_ETCD_SRV_SUFFIX: suffix for discovery SRV names. Requires PATRONI_ETCD_SRV. Use it to distinguish etcd clusters in one domain. For example,
PATRONI_ETCD_SRV_SUFFIX=fooandPATRONI_ETCD_SRV=example.orgproduce_etcd-client-ssl-foo._tcp.example.com. Patroni applies this suffix to each possible ETCD SRV service name. - PATRONI_ETCD_USERNAME: username for etcd authentication.
- PATRONI_ETCD_PASSWORD: password for etcd authentication.
- PATRONI_ETCD_CACERT: The ca certificate. If present it will enable validation.
- PATRONI_ETCD_CERT: File with the client certificate.
- PATRONI_ETCD_KEY: File with the client key. Can be empty if the key is part of certificate.
Etcdv3
For Etcdv3, replace ETCD with ETCD3 in Etcd variable names. Examples include PATRONI_ETCD3_HOST and PATRONI_ETCD3_CACERT.
Protocol versions 2 and 3 cannot see each other’s keys. Changing Patroni configuration alone cannot migrate Etcd to Etcdv3. Patroni uses the Etcd gRPC-gateway proxy for the V3 API. This prevents TLS common name authentication.
ZooKeeper
- PATRONI_ZOOKEEPER_HOSTS: Comma separated list of ZooKeeper cluster members: “‘host1:port1’,‘host2:port2’,’etc…’”. It is important to quote every single entity!
- PATRONI_ZOOKEEPER_USE_SSL: (optional) Whether SSL is used or not. Defaults to
false. If set tofalse, all SSL specific parameters are ignored. - PATRONI_ZOOKEEPER_CACERT: (optional) The CA certificate. If present it will enable validation.
- PATRONI_ZOOKEEPER_CERT: (optional) File with the client certificate.
- PATRONI_ZOOKEEPER_KEY: (optional) File with the client key.
- PATRONI_ZOOKEEPER_KEY_PASSWORD: (optional) The client key password.
- PATRONI_ZOOKEEPER_VERIFY: (optional) Whether to verify certificate or not. Defaults to
true. - PATRONI_ZOOKEEPER_SET_ACLS: (optional) default ACL that Kazoo applies to each new ZNode. Use
x509(default) or another supported ZooKeeper scheme, such asdigest. Supply a dictionary: each key is the full principal, optionally prefixed with its scheme. Each value lists one or more permissions:CREATE,READ,WRITE,DELETE,ADMIN, orALL. Example:set_acls: {CN=principal1: [CREATE, READ], digest:principal2:+pjROuBuuwNNSujKyH8dGcEnFPQ=: [ALL]}. - PATRONI_ZOOKEEPER_AUTH_DATA: (optional) connection authentication dictionary. Use
schemeas the key andcredentialas the value. Default: empty dictionary.
It is required to install kazoo>=2.6.0 to support SSL.
Exhibitor
- PATRONI_EXHIBITOR_HOSTS: initial list of Exhibitor (ZooKeeper) nodes in format: ‘host1,host2,etc…’. This list updates automatically whenever the Exhibitor (ZooKeeper) cluster topology changes.
- PATRONI_EXHIBITOR_PORT: Exhibitor port.
Kubernetes
- PATRONI_KUBERNETES_BYPASS_API_SERVICE: (optional) normally, Patroni contacts the kubernetes service at
KUBERNETES_SERVICE_HOST. WithPATRONI_KUBERNETES_BYPASS_API_SERVICEset totrue, it discovers the API nodes behind the service and contacts them directly. - PATRONI_KUBERNETES_NAMESPACE: (optional) Kubernetes namespace where the Patroni pod is running. Default value is
default. - PATRONI_KUBERNETES_LABELS: labels in
{label1: value1, label2: value2}format. Patroni uses them to find cluster Pods and Endpoints or ConfigMaps. It also adds them to each Endpoint or ConfigMap it creates. - PATRONI_KUBERNETES_SCOPE_LABEL: (optional) name of the label containing cluster name. Default value is
cluster-name. - PATRONI_KUBERNETES_BOOTSTRAP_LABELS: (optional) labels in
{label1: value1, label2: value2}format. Patroni assigns them to pods in these states:initializing new cluster,running custom bootstrap script,starting after custom bootstrap, orcreating replica. - PATRONI_KUBERNETES_ROLE_LABEL: (optional) name of the label containing role (
primary,replicaor other custom value). Patroni will set this label on the pod it runs in. Default value isrole. - PATRONI_KUBERNETES_LEADER_LABEL_VALUE: (optional) value of the pod label when Postgres role is
primary. Default value isprimary. - PATRONI_KUBERNETES_FOLLOWER_LABEL_VALUE: (optional) value of the pod label when Postgres role is
replica. Default value isreplica. - PATRONI_KUBERNETES_STANDBY_LEADER_LABEL_VALUE: (optional) value of the pod label when Postgres role is
standby_leader. Default value isprimary. - PATRONI_KUBERNETES_TMP_ROLE_LABEL: (optional) name of the temporary label containing role (
primaryorreplica). Value of this label will always use the default of corresponding role. Set only when necessary. - PATRONI_KUBERNETES_USE_ENDPOINTS: (optional) if set to true, Patroni will use Endpoints instead of ConfigMaps to run leader elections and keep cluster state.
- PATRONI_KUBERNETES_POD_IP: (optional) Patroni pod IP address. Required when
PATRONI_KUBERNETES_USE_ENDPOINTSis enabled. On promotion, Patroni uses this value to populate leader endpoint subsets. - PATRONI_KUBERNETES_PORTS: (optional) named Service ports require identical Endpoint port names. Otherwise, the service cannot work. For
{Kind: Service, spec: {ports: [{name: postgresql, port: 5432, targetPort: 5432}]}}, setPATRONI_KUBERNETES_PORTS='[{"name": "postgresql", "port": 5432}]'. Patroni uses this value to update leader Endpoint subsets. Applies only withPATRONI_KUBERNETES_USE_ENDPOINTS. - PATRONI_KUBERNETES_CACERT: (optional) CA_BUNDLE file with trusted CA certificates for Kubernetes API SSL verification. Defaults to the ServiceAccount secret value.
- PATRONI_RETRIABLE_HTTP_CODES: (optional) Kubernetes API status codes to retry. By default, Patroni retries
500,503, and504, and responses with aretry-afterHTTP header.
Raft (deprecated)
- PATRONI_RAFT_SELF_ADDR:
ip:portto listen on for Raft connections. Theself_addrmust be accessible from other nodes of the cluster. If not set, the node will not participate in consensus. - PATRONI_RAFT_BIND_ADDR: (optional)
ip:portto listen on for Raft connections. If not specified theself_addrwill be used. - PATRONI_RAFT_PARTNER_ADDRS: list of other Patroni nodes in the cluster in format
"'ip1:port1','ip2:port2'". It is important to quote every single entity! - PATRONI_RAFT_DATA_DIR: directory where to store Raft log and snapshot. If not specified the current working directory is used.
- PATRONI_RAFT_PASSWORD: (optional) Encrypt Raft traffic with a specified password, requires
cryptographypython module. - PATRONI_RAFT_MIN_TIMEOUT: (optional) minimum election timeout in seconds for the underlying pysyncobj Raft implementation. Must be greater than 3 *
PATRONI_RAFT_APPEND_ENTRIES_PERIOD. Default:0.4. - PATRONI_RAFT_MAX_TIMEOUT: (optional) maximum election timeout in seconds for the underlying pysyncobj Raft implementation. Must be greater than
PATRONI_RAFT_MIN_TIMEOUT. Default:1.4. - PATRONI_RAFT_CONNECTION_TIMEOUT: (optional) time in seconds after which a connection with no data received is considered dead. Must be greater than or equal to
PATRONI_RAFT_MAX_TIMEOUT. Default:3.5. - PATRONI_RAFT_APPEND_ENTRIES_PERIOD: (optional) interval in seconds for sending heartbeat commands. Must be less than one-third of
PATRONI_RAFT_MIN_TIMEOUT. Default:0.1. - PATRONI_RAFT_CONNECTION_RETRY_TIME: (optional) interval in seconds between reconnection attempts to offline nodes. Default:
5.0. - PATRONI_RAFT_LEADER_FALLBACK_TIMEOUT: (optional) time in seconds after which a leader with no response from the majority falls back to follower state. Must be greater than
PATRONI_RAFT_APPEND_ENTRIES_PERIOD. Default:30.0.
Patroni validates these constraints at startup and will refuse to start if they are violated. These values cannot be changed at runtime and require a restart. See Raft settings for details, including the high-latency limitation.
PostgreSQL
- PATRONI_POSTGRESQL_LISTEN: Postgres listen addresses and port. Separate multiple addresses with commas and append the port after the last address:
listen: 127.0.0.1,127.0.0.2:5432. Patroni uses the first address for local PostgreSQL connections. - PATRONI_POSTGRESQL_CONNECT_ADDRESS: IP address + port through which Postgres is accessible from other nodes and applications.
- PATRONI_POSTGRESQL_PROXY_ADDRESS: address and port of the connection pool beside Postgres, such as pgbouncer. Patroni stores it as
proxy_urlin the DCS member key for service discovery. - PATRONI_POSTGRESQL_DATA_DIR: The location of the Postgres data directory, either existing or to be initialized by Patroni.
- PATRONI_POSTGRESQL_CONFIG_DIR: The location of the Postgres configuration directory, defaults to the data directory. Must be writable by Patroni.
- PATRONI_POSTGRESQL_BIN_DIR: PostgreSQL binary directory: pg_ctl, initdb, pg_controldata, pg_basebackup, postgres, pg_isready, and pg_rewind. The default empty string uses PATH to find executables.
- PATRONI_POSTGRESQL_BIN_PG_CTL: (optional) Custom name for
pg_ctlbinary. - PATRONI_POSTGRESQL_BIN_INITDB: (optional) Custom name for
initdbbinary. - PATRONI_POSTGRESQL_BIN_PG_CONTROLDATA: (optional) Custom name for
pg_controldatabinary. - PATRONI_POSTGRESQL_BIN_PG_BASEBACKUP: (optional) Custom name for
pg_basebackupbinary. - PATRONI_POSTGRESQL_BIN_POSTGRES: (optional) Custom name for
postgresbinary. - PATRONI_POSTGRESQL_BIN_IS_READY: (optional) Custom name for
pg_isreadybinary. - PATRONI_POSTGRESQL_BIN_PG_REWIND: (optional) Custom name for
pg_rewindbinary. - PATRONI_POSTGRESQL_PGPASS: path to the .pgpass password file. Patroni creates this file before executing pg_basebackup and under some other circumstances. The location must be writable by Patroni.
- PATRONI_REPLICATION_USERNAME: replication username; the user will be created during initialization. Replicas will use this user to access the replication source via streaming replication
- PATRONI_REPLICATION_PASSWORD: replication password; the user will be created during initialization.
- PATRONI_REPLICATION_SSLMODE: (optional) maps to sslmode. Specifies the TLS negotiation mode. See the PostgreSQL documentation for each mode. Default:
prefer. - PATRONI_REPLICATION_SSLKEY: (optional) maps to sslkey. Path to the secret key for the client certificate.
- PATRONI_REPLICATION_SSLPASSWORD: (optional) maps to sslpassword. Password for the secret key in
PATRONI_REPLICATION_SSLKEY. - PATRONI_REPLICATION_SSLCERT: (optional) maps to sslcert. Path to the client certificate.
- PATRONI_REPLICATION_SSLROOTCERT: (optional) maps to sslrootcert. File containing one or more trusted CA certificates. The client uses them to verify the server certificate.
- PATRONI_REPLICATION_SSLCRL: (optional) maps to sslcrl. Certificate revocation list file. The client rejects servers whose certificates appear in the list.
- PATRONI_REPLICATION_SSLCRLDIR: (optional) maps to sslcrldir. Directory containing certificate revocation list files. The client rejects servers whose certificates appear in these lists.
- PATRONI_REPLICATION_SSLNEGOTIATION: (optional) maps to sslnegotiation. Controls server SSL negotiation when SSL is used.
- PATRONI_REPLICATION_GSSENCMODE: (optional) maps to gssencmode. Controls whether to negotiate secure GSS TCP/IP and its priority.
- PATRONI_REPLICATION_CHANNEL_BINDING: (optional) maps to channel_binding. Controls client channel binding.
- PATRONI_SUPERUSER_USERNAME: name for the superuser, set during initialization (initdb) and later used by Patroni to connect to the postgres. Also this user is used by pg_rewind.
- PATRONI_SUPERUSER_PASSWORD: password for the superuser, set during initialization (initdb).
- PATRONI_SUPERUSER_SSLMODE: (optional) maps to sslmode. Specifies the TLS negotiation mode. See the PostgreSQL documentation for each mode. Default:
prefer. - PATRONI_SUPERUSER_SSLKEY: (optional) maps to sslkey. Path to the secret key for the client certificate.
- PATRONI_SUPERUSER_SSLPASSWORD: (optional) maps to sslpassword. Password for the secret key in
PATRONI_SUPERUSER_SSLKEY. - PATRONI_SUPERUSER_SSLCERT: (optional) maps to sslcert. Path to the client certificate.
- PATRONI_SUPERUSER_SSLROOTCERT: (optional) maps to sslrootcert. File containing one or more trusted CA certificates. The client uses them to verify the server certificate.
- PATRONI_SUPERUSER_SSLCRL: (optional) maps to sslcrl. Certificate revocation list file. The client rejects servers whose certificates appear in the list.
- PATRONI_SUPERUSER_SSLCRLDIR: (optional) maps to sslcrldir. Directory containing certificate revocation list files. The client rejects servers whose certificates appear in these lists.
- PATRONI_SUPERUSER_SSLNEGOTIATION: (optional) maps to sslnegotiation. Controls server SSL negotiation when SSL is used.
- PATRONI_SUPERUSER_GSSENCMODE: (optional) maps to gssencmode. Controls whether to negotiate secure GSS TCP/IP and its priority.
- PATRONI_SUPERUSER_CHANNEL_BINDING: (optional) maps to channel_binding. Controls client channel binding.
- PATRONI_REWIND_USERNAME: (optional) name for the user for
pg_rewind; the user will be created during initialization of postgres 11+ and all necessary permissions will be granted. - PATRONI_REWIND_PASSWORD: (optional) password for the user for
pg_rewind; the user will be created during initialization. - PATRONI_REWIND_SSLMODE: (optional) maps to sslmode. Specifies the TLS negotiation mode. See the PostgreSQL documentation for each mode. Default:
prefer. - PATRONI_REWIND_SSLKEY: (optional) maps to sslkey. Path to the secret key for the client certificate.
- PATRONI_REWIND_SSLPASSWORD: (optional) maps to sslpassword. Password for the secret key in
PATRONI_REWIND_SSLKEY. - PATRONI_REWIND_SSLCERT: (optional) maps to sslcert. Path to the client certificate.
- PATRONI_REWIND_SSLROOTCERT: (optional) maps to sslrootcert. File containing one or more trusted CA certificates. The client uses them to verify the server certificate.
- PATRONI_REWIND_SSLCRL: (optional) maps to sslcrl. Certificate revocation list file. The client rejects servers whose certificates appear in the list.
- PATRONI_REWIND_SSLCRLDIR: (optional) maps to sslcrldir. Directory containing certificate revocation list files. The client rejects servers whose certificates appear in these lists.
- PATRONI_REWIND_SSLNEGOTIATION: (optional) maps to sslnegotiation. Controls server SSL negotiation when SSL is used.
- PATRONI_REWIND_GSSENCMODE: (optional) maps to gssencmode. Controls whether to negotiate secure GSS TCP/IP and its priority.
- PATRONI_REWIND_CHANNEL_BINDING: (optional) maps to channel_binding. Controls client channel binding.
REST API
- PATRONI_RESTAPI_THREAD_POOL_SIZE: size of thread pool used by Patroni to process REST API requests. Minimal value is
5, default value is5. - PATRONI_RESTAPI_CONNECT_ADDRESS: IP address and port to access the REST API.
- PATRONI_RESTAPI_LISTEN: IP address and port that Patroni will listen to, to provide health-check information for HAProxy.
- PATRONI_RESTAPI_USERNAME: Basic-auth username to protect unsafe REST API endpoints.
- PATRONI_RESTAPI_PASSWORD: Basic-auth password to protect unsafe REST API endpoints.
- PATRONI_RESTAPI_CERTFILE: Specifies the file with the certificate in the PEM format. If the certfile is not specified or is left empty, the API server will work without SSL.
- PATRONI_RESTAPI_KEYFILE: Specifies the file with the secret key in the PEM format.
- PATRONI_RESTAPI_KEYFILE_PASSWORD: Specifies a password for decrypting the keyfile.
- PATRONI_RESTAPI_CAFILE: Specifies the file with the CA_BUNDLE with certificates of trusted CAs to use while verifying client certs.
- PATRONI_RESTAPI_CIPHERS: (optional) Specifies the permitted cipher suites (e.g. “ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-GCM-SHA256:!SSLv1:!SSLv2:!SSLv3:!TLSv1:!TLSv1.1”)
- PATRONI_RESTAPI_VERIFY_CLIENT: (optional) client certificate verification mode:
none(default),optional, orrequired.nonedisables verification.requiredrequires certificates for all calls; successful signature verification authenticates the client.optionalrequires and checks certificates only for unsafePUT,POST,PATCH, andDELETErequests. - PATRONI_RESTAPI_ALLOWLIST: (optional) hosts permitted to call unsafe endpoints. Each entry can be a host name, IP address, or CIDR network. Default:
allow all. Withallowlistorallowlist_include_membersset, all unlisted sources are rejected. - PATRONI_RESTAPI_ALLOWLIST_INCLUDE_MEMBERS: (optional) if
true, permits unsafe endpoint access from cluster members registered in the DCS. It uses each member’sapi_urlhost name or IP address. The operating system may use a different address for outgoing connections. - PATRONI_RESTAPI_HTTP_EXTRA_HEADERS: (optional) HTTP headers let the REST API server pass additional information with an HTTP response.
- PATRONI_RESTAPI_HTTPS_EXTRA_HEADERS: (optional) HTTPS headers let the REST API server pass additional information with an HTTP response when TLS is enabled. This will also pass additional information set in
http_extra_headers. - PATRONI_RESTAPI_REQUEST_QUEUE_SIZE: (optional): Sets request queue size for TCP socket used by Patroni REST API. Once the queue is full, further requests get a “Connection denied” error. The default value is 5.
- PATRONI_RESTAPI_SERVER_TOKENS: (optional) Configures the value of the
ServerHTTP header.Original(default) will expose the original behaviour and display the BaseHTTP and Python versions, e.g.BaseHTTP/0.6 Python/3.12.3.Minimal: The header will contain only the Patroni version, e.g.Patroni/4.0.0.ProductOnly: The header will contain only the product name, e.g.Patroni.
Warning
- The
PATRONI_RESTAPI_CONNECT_ADDRESSmust be accessible from all nodes of a given Patroni cluster. Internally Patroni is using it during the leader race to find nodes with minimal replication lag. - If you enabled client certificates validation (
PATRONI_RESTAPI_VERIFY_CLIENTis set torequired), you also must provide valid client certificates in thePATRONI_CTL_CERTFILE,PATRONI_CTL_KEYFILE,PATRONI_CTL_KEYFILE_PASSWORD. If not provided, Patroni will not work correctly.
CTL
- PATRONICTL_CONFIG_FILE: (optional) location of the configuration file.
- PATRONI_CTL_USERNAME: (optional) Basic-auth username for accessing protected REST API endpoints. If not provided patronictl will use the value provided for REST API “username” parameter.
- PATRONI_CTL_PASSWORD: (optional) Basic-auth password for accessing protected REST API endpoints. If not provided patronictl will use the value provided for REST API “password” parameter.
- PATRONI_CTL_INSECURE: (optional) Allow connections to REST API without verifying SSL certs.
- PATRONI_CTL_CACERT: (optional) CA_BUNDLE file or directory with trusted CAs for REST API SSL verification. If absent, patronictl uses the REST API “cafile” value.
- PATRONI_CTL_CERTFILE: (optional) Specifies the file with the client certificate in the PEM format.
- PATRONI_CTL_KEYFILE: (optional) Specifies the file with the client secret key in the PEM format.
- PATRONI_CTL_KEYFILE_PASSWORD: (optional) Specifies a password for decrypting the client keyfile.