Overview

    Configuration

    the cluster you want

    • Identity: Parameters used for describing a PostgreSQL cluster
    • : Define a single instance cluster
    • Replica: Define a basic HA cluster with one primary & one replica
    • : Enable synchronous commit to ensure no data loss
    • Quorum Commit: Use quorum sync commit for an even higher consistency level
    • : Clone an existing cluster and follow it
    • Delayed Cluster: Clone an existing cluster for emergency data recovery
    • : Define a Citus distributed database cluster
    • : Init HA PostgreSQL clusters or adding new replicas.
    • pgsql-rm.yml : Remove PostgreSQL cluster, or remove replicas
    • : Add new business user to existing PostgreSQL cluster
    • pgsql-db.yml : Add new business database to existing PostgreSQL cluster
    • : Monitor remote postgres instance with local exporters
    • pgsql-migration.yml : Generate Migration manual & scripts for existing PostgreSQL

    Dashboards

    There are 23 default grafana dashboards about PostgreSQL and categorized into 4 levels, check PGSQL Monitor for details.

    Admin your existing clusters

    Parameters

    • PG_ID : Calculate & Check Postgres Identity
    • : Postgres Business Object Definition
    • PG_INSTALL : Install PGSQL Packages & Extensions
    • : Init a HA Postgres Cluster with Patroni
    • PG_PROVISION : Create users, databases, and in-database objects
    • : Setup backup repo with pgbackrest
    • PG_SERVICE : Exposing pg service, bind vip and register DNS
    • : Add Monitor for PGSQL Instance

    Parameters

    ParameterSectionTypeLevelComment
    pg_modeenumCpgsql cluster mode: pgsql,citus,gpsql
    pg_clusterstringCpgsql cluster name, REQUIRED identity parameter
    pg_seqintIpgsql instance seq number, REQUIRED identity parameter
    pg_roleenumIpgsql role, REQUIRED, could be primary,replica,offline
    pg_instancesdictIdefine multiple pg instances on node in format
    pg_upstreamipIrepl upstream ip addr for standby cluster or cascade replica
    pg_shardstringCpgsql shard name, optional identity for sharding clusters
    pg_groupintCpgsql shard index number, optional identity for sharding clusters
    gp_roleenumCgreenplum role of this cluster, could be master or segment
    pg_exportersdictCadditional pg_exporters to monitor remote postgres instances
    pg_offline_queryboolIset to true to enable offline query on this instance
    pg_usersuser[]Cpostgres business users
    pg_databasesdatabase[]Cpostgres business databases
    pg_servicesservice[]Cpostgres business services
    pg_hba_ruleshba[]Cbusiness hba rules for postgres
    pgb_hba_ruleshba[]Cbusiness hba rules for pgbouncer
    pg_replication_usernameusernameGpostgres replication username, replicator by default
    pg_replication_passwordpasswordGpostgres replication password, DBUser.Replicator by default
    pg_admin_usernameusernameGpostgres admin username, dbuser_dba by default
    pg_admin_passwordpasswordGpostgres admin password in plain text, DBUser.DBA by default
    pg_monitor_usernameusernameGpostgres monitor username, dbuser_monitor by default
    pg_monitor_passwordpasswordGpostgres monitor password, DBUser.Monitor by default
    pg_dbsu_passwordpasswordG/Cdbsu password, empty string means no dbsu password by default
    pg_dbsuusernameCos dbsu name, postgres by default, better not change it
    pg_dbsu_uidintCos dbsu uid and gid, 26 for default postgres users and groups
    pg_dbsu_sudoenumCdbsu sudo privilege, none,limit,all,nopass. limit by default
    pg_dbsu_homepathCpostgresql home directory, /var/lib/pgsql by default
    pg_dbsu_ssh_exchangeboolCexchange postgres dbsu ssh key among same pgsql cluster
    pg_versionenumCpostgres major version to be installed, 15 by default
    pg_bin_dirpathCpostgres binary dir, /usr/pgsql/bin by default
    pg_log_dirpathCpostgres log dir, /pg/log/postgres by default
    pg_packagesstring[]Cpg packages to be installed, ${pg_version} will be replaced
    pg_extensionsstring[]Cpg extensions to be installed, will be replaced
    pg_safeguardboolG/C/Aprevent purging running postgres instance? false by default
    pg_cleanboolG/C/Apurging existing postgres during pgsql init? true by default
    pg_datapathCpostgres data directory, /pg/data by default
    pg_fs_mainpathCmountpoint/path for postgres main data, /data by default
    pg_fs_bkuppathCmountpoint/path for pg backup data, /data/backup by default
    pg_storage_typeenumCstorage type for pg main data, SSD,HDD, SSD by default
    pg_dummy_filesizesizeCsize of /pg/dummy, hold 64MB disk space for emergency use
    pg_listenipCpostgres listen address, 0.0.0.0 (all ipv4 addr) by default
    pg_portportCpostgres listen port, 5432 by default
    pg_localhostpathCpostgres unix socket dir for localhost connection
    pg_namespacepathCtop level key namespace in etcd, used by patroni & vip
    patroni_enabledboolCif disabled, no postgres cluster will be created during init
    patroni_modeenumCpatroni working mode: default,pause,remove
    patroni_portportCpatroni listen port, 8008 by default
    patroni_log_dirpathCpatroni log dir, /pg/log/patroni by default
    patroni_ssl_enabledboolGsecure patroni RestAPI communications with SSL?
    patroni_watchdog_modeenumCpatroni watchdog mode: automatic,required,off. off by default
    patroni_usernameusernameCpatroni restapi username, postgres by default
    patroni_passwordpasswordCpatroni restapi password, Patroni.API by default
    pg_confenumCconfig template: oltp,olap,crit,tiny. oltp.yml by default
    pg_max_connintCpostgres max connections, auto will use recommended value
    pg_shared_buffer_ratiofloatCpostgres shared buffer memory ratio, 0.25 by default, 0.1~0.4
    pg_rtointCrecovery time objective in seconds, by default
    pg_rpointCrecovery point objective in bytes, 1MiB at most by default
    pg_libsstringCpreloaded libraries, pg_stat_statements,auto_explain by default
    pg_delayintervalIreplication apply delay for standby cluster leader
    pg_checksumboolCenable data checksum for postgres cluster?
    pg_pwd_encenumCpasswords encryption algorithm: md5,scram-sha-256
    pg_encodingenumCdatabase cluster encoding, UTF8 by default
    pg_localeenumCdatabase cluster local, C by default
    pg_lc_collateenumCdatabase cluster collate, C by default
    pg_lc_ctypeenumCdatabase character type, en_US.UTF8 by default
    pgbouncer_enabledboolCif disabled, pgbouncer will not be launched on pgsql host
    pgbouncer_portportCpgbouncer listen port, 6432 by default
    pgbouncer_log_dirpathCpgbouncer log dir, /pg/log/pgbouncer by default
    pgbouncer_auth_queryboolCquery postgres to retrieve unlisted business users?
    pgbouncer_poolmodeenumCpooling mode: transaction,session,statement, transaction by default
    pgbouncer_sslmodeenumCpgbouncer client ssl mode, disable by default
    pg_provisionboolCprovision postgres cluster after bootstrap
    pg_initstringG/Cprovision init script for cluster template, pg-init by default
    pg_default_rolesrole[]G/Cdefault roles and users in postgres cluster
    pg_default_privilegesstring[]G/Cdefault privileges when created by admin user
    pg_default_schemasstring[]G/Cdefault schemas to be created
    pg_default_extensionsextension[]G/Cdefault extensions to be created
    pg_reloadboolAreload postgres after hba changes
    pg_default_hba_ruleshba[]G/Cpostgres default host-based authentication rules
    pgb_default_hba_ruleshba[]G/Cpgbouncer default host-based authentication rules
    pgbackrest_enabledboolCenable pgbackrest on pgsql host?
    pgbackrest_cleanboolCremove pg backup data during init?
    pgbackrest_log_dirpathCpgbackrest log dir, /pg/log/pgbackrest by default
    pgbackrest_methodenumCpgbackrest repo method: local,minio,etc…
    pgbackrest_repodictG/Cpgbackrest repo: https://pgbackrest.org/configuration.html#section-repository
    PG_SERVICEintIrelative load balance weight in service, 100 by default, 0-255
    PG_SERVICEenumG/Cdedicate haproxy node group name, or empty string for local nodes by default
    PG_SERVICEenumG/Cdefault service destination if svc.dest=‘default’
    PG_SERVICEservice[]G/Cpostgres default service definitions
    PG_SERVICEboolCenable a l2 vip for pgsql primary? false by default
    PG_SERVICEcidr4Cvip address in <ipv4>/<mask> format, require if vip is enabled
    PG_SERVICEstringC/Ivip network interface to listen, eth0 by default
    PG_SERVICEstringCpgsql dns suffix, ’’ by default
    PG_SERVICEenumCauto, primary, vip, none, or ad hoc ip
    PG_EXPORTERboolCenable pg_exporter on pgsql hosts?
    PG_EXPORTERstringCpg_exporter configuration file name
    PG_EXPORTERstringCpg_exporter collector ttl stage in seconds, ‘1,10,60,300’ by default
    PG_EXPORTERportCpg_exporter listen port, 9630 by default
    PG_EXPORTERstringCextra url parameters for pg_exporter dsn
    PG_EXPORTERpgurlCoverwrite auto-generate pg dsn if specified
    PG_EXPORTERboolCenable auto database discovery? enabled by default
    PG_EXPORTERstringCcsv of database that WILL NOT be monitored during auto-discovery
    PG_EXPORTERstringCcsv of database that WILL BE monitored during auto-discovery
    PG_EXPORTERintCpg_exporter connect timeout in ms, 200 by default
    PG_EXPORTERargCoverwrite extra options for pg_exporter
    PG_EXPORTERboolCenable pgbouncer_exporter on pgsql hosts?
    PG_EXPORTERportCpgbouncer_exporter listen port, 9631 by default
    PG_EXPORTERpgurlCoverwrite auto-generate pgbouncer dsn if specified
    PG_EXPORTERargCoverwrite extra options for pgbouncer_exporter
    • Fork an existing PostgreSQL cluster.
    • Create a standby cluster of an existing PostgreSQL cluster.
    • Create a delayed cluster of another pgsql cluster?
    • Monitoring an existing postgres instance?
    • Migration from an external PostgreSQL with logical replication?
    • Use MinIO as a central pgBackRest repo.
    • Use dedicate etcd cluster for DCS?
    • Use dedicated haproxy for exposing PostgreSQL service.
    • Deploy a multi-node MinIO cluster?
    • Use CMDB instead of Config as inventory.
    • Use PostgreSQL as grafana backend storage ?

    Last modified 2023-02-27: refresh en docs to v2.0 (e82b371)