<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Patroni configuration on PIG.CENTER</title><link>https://pig.center/docs/patroni/config/</link><description>Recent content in Patroni configuration on PIG.CENTER</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Tue, 08 Sep 2026 21:29:01 +0800</lastBuildDate><atom:link href="https://pig.center/docs/patroni/config/index.xml" rel="self" type="application/rss+xml"/><item><title>Dynamic Configuration Settings</title><link>https://pig.center/docs/patroni/config/dynamic/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://pig.center/docs/patroni/config/dynamic/</guid><description>&lt;p&gt;&lt;a id="dynamic"&gt;&lt;/a&gt;&#10;Dynamic configuration is stored in the DCS (Distributed Configuration Store) and applied on all cluster nodes.&lt;/p&gt;&#10;&lt;p&gt;In order to change the dynamic configuration you can use either &lt;a href="https://pig.center/docs/patroni/patronictl/#patronictl_edit_config"&gt;patronictl_edit_config&lt;/a&gt;&#10; tool or Patroni &lt;a href="https://pig.center/docs/patroni/rest_api/#rest_api"&gt;REST API&lt;/a&gt;&#10;.&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;loop_wait&lt;/strong&gt;: the number of seconds the loop will sleep. Default value: 10, minimum possible value: 1&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;ttl&lt;/strong&gt;: the TTL to acquire the leader lock (in seconds). Think of it as the length of time before initiation of the automatic failover process. Default value: 30, minimum possible value: 20&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;retry_timeout&lt;/strong&gt;: 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&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;div class="td-callout td-callout--warning" role="note"&gt;&#10; &lt;div class="td-callout__title"&gt;&lt;i class="td-callout__icon fa-solid fa-triangle-exclamation" aria-hidden="true"&gt;&lt;/i&gt;&lt;span class="td-callout__label"&gt;Warning&lt;/span&gt;&lt;/div&gt;&#10; &lt;div class="td-callout__body"&gt;&#10;&lt;p&gt;when changing values of &lt;strong&gt;loop_wait&lt;/strong&gt;, &lt;strong&gt;retry_timeout&lt;/strong&gt;, or &lt;strong&gt;ttl&lt;/strong&gt; you have to follow the rule:&lt;/p&gt;</description></item><item><title>YAML Configuration Settings</title><link>https://pig.center/docs/patroni/config/yaml/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://pig.center/docs/patroni/config/yaml/</guid><description>&lt;p&gt;&lt;a id="yaml"&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;hr&gt;&#10;&lt;h2 id="globaluniversal"&gt;Global/Universal&#10;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;thread_pool_size&lt;/strong&gt;: size of thread pool used by Patroni to execute asynchronous tasks and communicate via REST API with other members during leader race or failsafe checks. Minimal value is &lt;code&gt;5&lt;/code&gt;, default value is &lt;code&gt;5&lt;/code&gt;.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;thread_stack_size&lt;/strong&gt;: specifies the stack size to be used for threads started by Patroni. Value must be aligned by &lt;code&gt;64kB&lt;/code&gt;. Minimal value is &lt;code&gt;64kB&lt;/code&gt;, default value (set by Patroni) is &lt;code&gt;512kB&lt;/code&gt;.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;name&lt;/strong&gt;: the name of the host. Must be unique for the cluster. The value &lt;code&gt;__patroni_strict_sync_replica_placeholder__&lt;/code&gt; is reserved for internal use by Patroni and cannot be used as a node name.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;namespace&lt;/strong&gt;: path within the configuration store where Patroni will keep information about the cluster. Default value: &amp;ldquo;/service&amp;rdquo;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;scope&lt;/strong&gt;: cluster name&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;&lt;a id="log_settings"&gt;&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Environment Configuration Settings</title><link>https://pig.center/docs/patroni/config/env/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://pig.center/docs/patroni/config/env/</guid><description>&lt;p&gt;&lt;a id="env"&gt;&lt;/a&gt;&#10;It is possible to override some of the configuration parameters defined in the Patroni configuration file using the system environment variables. This document lists all environment variables handled by Patroni. The values set via those variables always take precedence over the ones set in the Patroni configuration file.&lt;/p&gt;&#10;&lt;hr&gt;&#10;&lt;h2 id="globaluniversal"&gt;Global/Universal&#10;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;PATRONI_CONFIGURATION&lt;/strong&gt;: it is possible to set the entire configuration for the Patroni via &lt;a href="https://pig.center/docs/patroni/config/#config"&gt;PATRONI_CONFIGURATION&lt;/a&gt;&#10; environment variable. In this case any other environment variables will not be considered!&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;PATRONI_THREAD_POOL_SIZE&lt;/strong&gt;: size of thread pool used by Patroni to execute asynchronous tasks and communicate via REST API with other members during leader race or failsafe checks. Minimal value is &lt;code&gt;5&lt;/code&gt;, default value is &lt;code&gt;5&lt;/code&gt;.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;PATRONI_THREAD_STACK_SIZE&lt;/strong&gt;: specifies the stack size to be used for threads started by Patroni. Value must be aligned by &lt;code&gt;64kB&lt;/code&gt;. Minimal value is &lt;code&gt;64kB&lt;/code&gt;, default value (set by Patroni) is &lt;code&gt;512kB&lt;/code&gt;.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;PATRONI_NAME&lt;/strong&gt;: name of the node where the current instance of Patroni is running. Must be unique for the cluster. The value &lt;code&gt;__patroni_strict_sync_replica_placeholder__&lt;/code&gt; is reserved for internal use by Patroni and cannot be used as a node name.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;PATRONI_NAMESPACE&lt;/strong&gt;: path within the configuration store where Patroni will keep information about the cluster. Default value: &amp;ldquo;/service&amp;rdquo;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;PATRONI_SCOPE&lt;/strong&gt;: cluster name&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;PG_MALLOC_ARENA_MAX&lt;/strong&gt;: custom value for &lt;code&gt;MALLOC_ARENA_MAX&lt;/code&gt; environment variable for &lt;code&gt;postmaster&lt;/code&gt; process. If not set, &lt;code&gt;postmaster&lt;/code&gt; will inherit &lt;code&gt;MALLOC_ARENA_MAX&lt;/code&gt; value.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;hr&gt;&#10;&lt;h2 id="log"&gt;Log&#10;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;PATRONI_LOG_TYPE&lt;/strong&gt;: sets the format of logs. Can be either &lt;strong&gt;plain&lt;/strong&gt; or &lt;strong&gt;json&lt;/strong&gt;. To use &lt;strong&gt;json&lt;/strong&gt; format, you must have the &lt;a href="https://pig.center/docs/patroni/installation/#extras"&gt;jsonlogger&lt;/a&gt;&#10; installed. The default value is &lt;strong&gt;plain&lt;/strong&gt;.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;PATRONI_LOG_LEVEL&lt;/strong&gt;: sets the general logging level. Default value is &lt;strong&gt;INFO&lt;/strong&gt; (see &lt;a href="https://docs.python.org/3.6/library/logging.html#levels"&gt;the docs for Python logging&lt;/a&gt;&#10;)&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;PATRONI_LOG_TRACEBACK_LEVEL&lt;/strong&gt;: sets the level where tracebacks will be visible. Default value is &lt;strong&gt;ERROR&lt;/strong&gt;. Set it to &lt;strong&gt;DEBUG&lt;/strong&gt; if you want to see tracebacks only if you enable &lt;strong&gt;PATRONI_LOG_LEVEL=DEBUG&lt;/strong&gt;.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;PATRONI_LOG_FORMAT&lt;/strong&gt;: sets the log formatting string. If the log type is &lt;strong&gt;plain&lt;/strong&gt;, the log format should be a string. Refer to &lt;a href="https://docs.python.org/3.6/library/logging.html#logrecord-attributes"&gt;the LogRecord attributes&lt;/a&gt;&#10; for available attributes. If the log type is &lt;strong&gt;json&lt;/strong&gt;, the log format can be a list in addition to a string. Each list item should correspond to LogRecord attributes. Be cautious that only the field name is required, and the &lt;strong&gt;%(&lt;/strong&gt; and &lt;strong&gt;)&lt;/strong&gt; should be omitted. If you wish to print a log field with a different key name, use a dictionary where the dictionary key is the log field, and the value is the name of the field you want to be printed in the log. Default value is &lt;strong&gt;%(asctime)s %(levelname)s: %(message)s&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;PATRONI_LOG_DATEFORMAT&lt;/strong&gt;: sets the datetime formatting string. (see the &lt;a href="https://docs.python.org/3.6/library/logging.html#logging.Formatter.formatTime"&gt;formatTime() documentation&lt;/a&gt;&#10;)&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;PATRONI_LOG_STATIC_FIELDS&lt;/strong&gt;: add additional fields to the log. This option is only available when the log type is set to &lt;strong&gt;json&lt;/strong&gt;. Example &lt;code&gt;PATRONI_LOG_STATIC_FIELDS=&amp;quot;{app: patroni}&amp;quot;&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;PATRONI_LOG_MAX_QUEUE_SIZE&lt;/strong&gt;: Patroni is using two-step logging. Log records are written into the in-memory queue and there is a separate thread which pulls them from the queue and writes to stderr or file. The maximum size of the internal queue is limited by default by &lt;strong&gt;1000&lt;/strong&gt; records, which is enough to keep logs for the past 1h20m.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;PATRONI_LOG_DIR&lt;/strong&gt;: Directory to write application logs to. The directory must exist and be writable by the user executing Patroni. If you set this env variable, the application will retain 4 25MB logs by default. You can tune those retention values with &lt;code&gt;PATRONI_LOG_FILE_NUM&lt;/code&gt; and &lt;code&gt;PATRONI_LOG_FILE_SIZE&lt;/code&gt; (see below).&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;PATRONI_LOG_MODE&lt;/strong&gt;: Permissions for log files (for example, &lt;code&gt;0644&lt;/code&gt;). If not specified, permissions will be set based on the current umask value.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;PATRONI_LOG_FILE_NUM&lt;/strong&gt;: The number of application logs to retain.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;PATRONI_LOG_FILE_SIZE&lt;/strong&gt;: Size of patroni.log file (in bytes) that triggers a log rolling.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;PATRONI_LOG_LOGGERS&lt;/strong&gt;: Redefine logging level per python module. Example &lt;code&gt;PATRONI_LOG_LOGGERS=&amp;quot;{patroni.postmaster: WARNING, urllib3: DEBUG}&amp;quot;&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;PATRONI_LOG_DEDUPLICATE_HEARTBEAT_LOGS&lt;/strong&gt;: If set to &lt;code&gt;true&lt;/code&gt;, successive heartbeat logs that are identical shall not be output. Default value is &lt;code&gt;false&lt;/code&gt;.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;div class="td-callout td-callout--warning" role="note"&gt;&#10; &lt;div class="td-callout__title"&gt;&lt;i class="td-callout__icon fa-solid fa-triangle-exclamation" aria-hidden="true"&gt;&lt;/i&gt;&lt;span class="td-callout__label"&gt;Warning&lt;/span&gt;&lt;/div&gt;&#10; &lt;div class="td-callout__body"&gt;&#10;&lt;p&gt;The time the HA loop executes at can be very valuable information in diagnosing failovers due to resource exhaustion and similar problems. When &lt;code&gt;PATRONI_LOG_DEDUPLICATE_HEARTBEAT_LOGS&lt;/code&gt; is set to &lt;code&gt;true&lt;/code&gt; there will be no log generated for the HA loop execution (unless the leader changes) and hence this potentially useful information will not be available from the logs.&lt;/p&gt;</description></item></channel></rss>