Skip to content

pgmoneta configuration

The configuration is loaded from either the path specified by the -c flag or /etc/pgmoneta/pgmoneta.conf.

The configuration of pgmoneta is split into sections using the [ and ] characters.

The main section, called [pgmoneta], is where you configure the overall properties of pgmoneta.

Other sections doesn't have any requirements to their naming so you can give them meaningful names like [primary] for the primary PostgreSQL instance.

All properties are in the format key = value.

The characters # and ; can be used for comments; must be the first character on the line. The Bool data type supports the following values: on, yes, 1, true, off, no, 0 and false.

See a sample configuration for running pgmoneta on localhost.

[pgmoneta]

PropertyDefaultUnitRequiredDescription
hostStringYesThe bind address for pgmoneta
unix_socket_dirStringYesThe Unix Domain Socket location
base_dirStringYesThe base directory for the backup
metrics0IntNoThe metrics port (disable = 0)
metrics_cache_max_age0StringNoThe number of seconds to keep in cache a Prometheus (metrics) response. If set to zero, the caching will be disabled. Can be a string with a suffix, like 2m to indicate 2 minutes
metrics_cache_max_size256kStringNoThe maximum amount of data to keep in cache when serving Prometheus responses. Changes require restart. This parameter determines the size of memory allocated for the cache even if metrics_cache_max_age or metrics are disabled. Its value, however, is taken into account only if metrics_cache_max_age is set to a non-zero value. Supports suffixes: 'B' (bytes), the default if omitted, 'K' or 'KB' (kilobytes), 'M' or 'MB' (megabytes), 'G' or 'GB' (gigabytes).
management0IntNoThe remote management port (disable = 0)
compressionzstdStringNoThe compression type (none, gzip, client-gzip, server-gzip, zstd, client-zstd, server-zstd, lz4, client-lz4, server-lz4, bzip2, client-bzip2)
compression_level3IntNoThe compression level
workers0IntNoThe number of workers that each process can use for its work. Use 0 to disable
storage_enginelocalStringNoThe storage engine type (local, ssh, s3, azure)
encryptionnoneStringNoThe encryption mode for encrypt wal and data
none: No encryption
aes | aes-256 | aes-256-cbc: AES CBC (Cipher Block Chaining) mode with 256 bit key length
aes-192 | aes-192-cbc: AES CBC mode with 192 bit key length
aes-128 | aes-128-cbc: AES CBC mode with 128 bit key length
aes-256-ctr: AES CTR (Counter) mode with 256 bit key length
aes-192-ctr: AES CTR mode with 192 bit key length
aes-128-ctr: AES CTR mode with 128 bit key length
create_slotnoBoolNoCreate a replication slot for all server. Valid values are: yes, no
ssh_hostnameStringYesDefines the hostname of the remote system for connection
ssh_usernameStringYesDefines the username of the remote system for connection
ssh_base_dirStringYesThe base directory for the remote backup
ssh_ciphersaes-256-ctr, aes-192-ctr, aes-128-ctrStringNoThe supported ciphers for communication. aes | aes-256 | aes-256-cbc: AES CBC (Cipher Block Chaining) mode with 256 bit key length
aes-192 | aes-192-cbc: AES CBC mode with 192 bit key length
aes-128 | aes-128-cbc: AES CBC mode with 128 bit key length
aes-256-ctr: AES CTR (Counter) mode with 256 bit key length
aes-192-ctr: AES CTR mode with 192 bit key length
aes-128-ctr: AES CTR mode with 128 bit key length. Otherwise verbatim
s3_aws_regionStringYesThe AWS region
s3_access_key_idStringYesThe IAM access key ID
s3_secret_access_keyStringYesThe IAM secret access key
s3_bucketStringYesThe AWS S3 bucket name
s3_base_dirStringYesThe base directory for the S3 bucket
azure_storage_accountStringYesThe Azure storage account name
azure_containerStringYesThe Azure container name
azure_shared_keyStringYesThe Azure storage account key
azure_base_dirStringYesThe base directory for the Azure container
retention7, - , - , -ArrayNoThe retention time in days, weeks, months, years
linkonBoolNoUse links to limit backup size
log_typeconsoleStringNoThe logging type (console, file, syslog)
log_levelinfoStringNoThe logging level, any of the (case insensitive) strings FATAL, ERROR, WARN, INFO and DEBUG (that can be more specific as DEBUG1 thru DEBUG5). Debug level greater than 5 will be set to DEBUG5. Not recognized values will make the log_level be INFO
log_pathpgmoneta.logStringNoThe log file location. Can be a strftime(3) compatible string.
log_rotation_age0StringNoThe age that will trigger a log file rotation. If expressed as a positive number, is managed as seconds. Supports suffixes: 'S' (seconds, the default), 'M' (minutes), 'H' (hours), 'D' (days), 'W' (weeks). A value of 0 disables.
log_rotation_size0StringNoThe size of the log file that will trigger a log rotation. Supports suffixes: 'B' (bytes), the default if omitted, 'K' or 'KB' (kilobytes), 'M' or 'MB' (megabytes), 'G' or 'GB' (gigabytes). A value of 0 (with or without suffix) disables.
log_line_prefix%Y-%m-%d %H:%M:%SStringNoA strftime(3) compatible string to use as prefix for every log line. Must be quoted if contains spaces.
log_modeappendStringNoAppend to or create the log file (append, create)
blocking_timeout30IntNoThe number of seconds the process will be blocking for a connection (disable = 0)
tlsoffBoolNoEnable Transport Layer Security (TLS)
tls_cert_fileStringNoCertificate file for TLS. This file must be owned by either the user running pgmoneta or root.
tls_key_fileStringNoPrivate key file for TLS. This file must be owned by either the user running pgmoneta or root. Additionally permissions must be at least 0640 when owned by root or 0600 otherwise.
tls_ca_fileStringNoCertificate Authority (CA) file for TLS. This file must be owned by either the user running pgmoneta or root.
libevautoStringNoSelect the libev backend to use. Valid options: auto, select, poll, epoll, iouring, devpoll and port
buffer_size65535IntNoThe network buffer size (SO_RCVBUF and SO_SNDBUF)
backup_max_rate0IntNoThe number of bytes of tokens added every one second to limit the backup rate
network_max_rate0IntNoThe number of bytes of tokens added every one second to limit the netowrk backup rate
keep_aliveonBoolNoHave SO_KEEPALIVE on sockets
nodelayonBoolNoHave TCP_NODELAY on sockets
non_blockingonBoolNoHave O_NONBLOCK on sockets
backlog16IntNoThe backlog for listen(). Minimum 16
hugepagetryStringNoHuge page support (off, try, on)
pidfileStringNoPath to the PID file. If not specified, it will be automatically set to unix_socket_dir/pgmoneta.<host>.pid where <host> is the value of the host parameter or all if host = *.
update_process_titleverboseStringNoThe behavior for updating the operating system process title. Allowed settings are: never (or off), does not update the process title; strict to set the process title without overriding the existing initial process title length; minimal to set the process title to the base description; verbose (or full) to set the process title to the full description. Please note that strict and minimal are honored only on those systems that do not provide a native way to set the process title (e.g., Linux). On other systems, there is no difference between strict and minimal and the assumed behaviour is minimal even if strict is used. never and verbose are always honored, on every system. On Linux systems the process title is always trimmed to 255 characters, while on system that provide a natve way to set the process title it can be longer.

Server section

PropertyDefaultUnitRequiredDescription
hostStringYesThe address of the PostgreSQL instance
portIntYesThe port of the PostgreSQL instance
userStringYesThe replication user name
wal_slotStringYesThe replication slot for WAL
create_slotnoBoolNoCreate a replication slot for this server. Valid values are: yes, no
followStringNoFailover to this server if follow server fails
retentionArrayNoThe retention for the server in days, weeks, months, years
wal_shippingStringNoThe WAL shipping directory
hot_standbyStringNoHot standby directory
hot_standby_overridesStringNoFiles to override in the hot standby directory
workers-1IntNoThe number of workers that each process can use for its work. Use 0 to disable, -1 means use the global settting
backup_max_rate-1IntNoThe number of bytes of tokens added every one second to limit the backup rate. Use 0 to disable, -1 means use the global settting
network_max_rate-1IntNoThe number of bytes of tokens added every one second to limit the netowrk backup rate. Use 0 to disable, -1 means use the global settting
tls_cert_fileStringNoCertificate file for TLS. This file must be owned by either the user running pgmoneta or root.
tls_key_fileStringNoPrivate key file for TLS. This file must be owned by either the user running pgmoneta or root. Additionally permissions must be at least 0640 when owned by root or 0600 otherwise.
tls_ca_fileStringNoCertificate Authority (CA) file for TLS. This file must be owned by either the user running pgmoneta or root.

The user specified must have the REPLICATION option in order to stream the Write-Ahead Log (WAL), and must have access to the postgres database in order to get the necessary configuration parameters.

Note, that PostgreSQL 13+ is required, as well as having wal_level at replica or logical level.

Note, that if host starts with a / it represents a path and pgmoneta will connect using a Unix Domain Socket.

pgmoneta_users configuration

The pgmoneta_users configuration defines the users known to the system. This file is created and managed through the pgmoneta-admin tool.

The configuration is loaded from either the path specified by the -u flag or /etc/pgmoneta/pgmoneta_users.conf.

pgmoneta_admins configuration

The pgmoneta_admins configuration defines the administrators known to the system. This file is created and managed through the pgmoneta-admin tool.

The configuration is loaded from either the path specified by the -A flag or /etc/pgmoneta/pgmoneta_admins.conf.

If pgmoneta has both Transport Layer Security (TLS) and management enabled then pgmoneta-cli can connect with TLS using the files ~/.pgmoneta/pgmoneta.key (must be 0600 permission), ~/.pgmoneta/pgmoneta.crt and ~/.pgmoneta/root.crt.