Default

Pigsty 4-node local sandbox demo config

``` 1. --- 2. ###################################################################### 3. # File : pigsty.yml 4. # Desc : Pigsty 4-node local sandbox demo config 5. # Link : https://pigsty.cc/#/v-config 6. # Ctime : 2020-05-22 7. # Mtime : 2022-05-22 8. # Copyright (C) 2018-2022 Ruohang Feng (rh@vonng.com) 9. ######################################################################

  1. Sandbox (4-node)

  2. ====================================================================

  3. admin user : vagrant (nopass ssh & sudo already set)

  4. 1. meta : 10.10.10.10 (2 Core | 4GB) pg-meta

  5. 2. node-1 : 10.10.10.11 (1 Core | 1GB) pg-test-1

  6. 3. node-2 : 10.10.10.12 (1 Core | 1GB) pg-test-2

  7. 4. node-3 : 10.10.10.13 (1 Core | 1GB) pg-test-3

  8. (replace these ip if your 4-node env have different ip addr)

  9. VIP 2: (l2 vip is available inside same LAN )

  10. pg-meta ---> 10.10.10.2 ---> 10.10.10.10

  11. pg-test ---> 10.10.10.3 ---> 10.10.10.1{1,2,3}

  12. all:

  13. CLUSTERS

  14. meta nodes, nodes, pgsql, redis, pgsql clusters are defined as

  15. k:v pair inside all.children. Where the key is cluster name

  16. and value is cluster definition consist of two parts:

  17. hosts: cluster members ip and instance level variables

  18. vars : cluster level variables

  19. children: # groups definition

  20. ================================================================

  21. Meta Nodes: Admin Controller

  22. ================================================================

  23. meta: # meta nodes are defined in this special group "meta"
  24. vars:
  25. meta_node: true # mark this group as meta nodes
  26. ansible_group_priority: 99 # overwrite with the highest priority

  27. nginx_enabled: true # setup repo & underlying nginx

  28. nameserver_enabled: false # setup dnsmasq
  29. prometheus_enabled: true # setup prometheus
  30. grafana_enabled: true # setup grafana
  31. loki_enabled: true # setup loki
  32. docker_enabled: true # setup docker
  33. dcs_safeguard: false # protect dcs server from fat fingers

  34. hosts: # add nodes to group 'meta'

  35. 10.10.10.10: { }
  36. 10.10.10.11: { nginx_enabled: false }

  37. 10.10.10.12: { nginx_enabled: false }

  38. ================================================================

  39. ================================================================

  40. PGSQL Clusters

  41. ================================================================

  42. ----------------------------------

  43. pgsql cluster: pg-meta (CMDB)

  44. ----------------------------------

  45. EXAMPLE pg-meta is the default SINGLE-NODE pgsql cluster deployed on meta node (10.10.10.10)

  46. pg-meta: # [REQUIRED], ansible group name , pgsql cluster name. should be unique among environment
  47. hosts: # <cluster>.hosts holds instances definition of this cluster
  48. 10.10.10.10: # [REQUIRED]: ip address is the key. values are instance level config entries (dict)
  49. pg_seq: 1 # [REQUIRED], unique identity parameter (+integer) among pg_cluster
  50. pg_role: primary # [REQUIRED], pg_role is mandatory identity parameter, primary|replica|offline
  51. pg_offline_query: true # instance with pg_offline_query: true will take offline traffic (saga, etl,...)
  52. pg_upstream: x.x.x.x # some other variables can be overwritten on instance level. e.g: pg_upstream, pg_weight, etc...

  53. pg_weight: 100 # load balance weight for this instance

  54. vars: # <cluster>.vars holds CLUSTER LEVEL CONFIG of this pgsql cluster

  55. pg_cluster: pg-meta # [REQUIRED], pgsql cluster name, unique among cluster, used as namespace of cluster resources

  56. all vars below are [OPTIONAL] (overwrite global default)

  57. pg_version: 14 # pgsql version to be installed (use global version if missing)
  58. node_tune: tiny # node optimization profile: {oltp|olap|crit|tiny}, use tiny for vm sandbox
  59. pg_conf: tiny.yml # pgsql template: {oltp|olap|crit|tiny}, use tiny for sandbox
  60. patroni_watchdog_mode: off # disable patroni watchdog on meta node {off|require|automatic}
  61. pg_lc_ctype: en_US.UTF8 # use en_US.UTF8 locale for i18n char support (required by pg_trgm)

  62. define business database meta , used as CMDB & default database for single-node setup

  63. pg_databases: # define business databases on this cluster, array of database definition
    • name: meta # required, name is the only mandatory field of a database definition
  64. baseline: cmdb.sql # optional, database sql baseline path, (relative path among ansible search path, e.g files/)
  65. owner: postgres # optional, database owner, postgres by default

  66. template: template1 # optional, which template to use, template1 by default

  67. encoding: UTF8 # optional, database encoding, UTF8 by default. (MUST same as template database)

  68. locale: C # optional, database locale, C by default. (MUST same as template database)

  69. lc_collate: C # optional, database collate, C by default. (MUST same as template database)

  70. lc_ctype: C # optional, database ctype, C by default. (MUST same as template database)

  71. tablespace: pg_default # optional, default tablespace, 'pg_default' by default.

  72. allowconn: true # optional, allow connection, true by default. false will disable connect at all

  73. revokeconn: false # optional, revoke public connection privilege. false by default. (leave connect with grant option to owner)

  74. pgbouncer: true # optional, add this database to pgbouncer database list? true by default

  75. comment: pigsty meta database # optional, comment string for this database
  76. connlimit: -1 # optional, database connection limit, default -1 disable limit
  77. schemas: [pigsty] # optional, additional schemas to be created, array of schema names
  78. extensions: # optional, additional extensions to be installed: array of schema definition {name,schema}
    • { name: adminpack, schema: pg_catalog } # install adminpack to pg_catalog
    • { name: postgis, schema: public } # if schema is omitted, extension will be installed according to search_path.
    • { name: timescaledb } # some extensions are not relocatable, you can just omit the schema part
    • { name: grafana, owner: dbuser_grafana , revokeconn: true , comment: grafana primary database }
    • { name: bytebase, owner: dbuser_bytebase , revokeconn: true , comment: bytebase primary database }
    • { name: kong, owner: dbuser_kong , revokeconn: true , comment: kong the api gateway database }
  79. define business users for this cluster

  80. pg_users: # define business users/roles on this cluster, array of user definition
  81. define admin user for meta database (This user are used for pigsty app deployment by default)

    • name: dbuser_meta # required, name is the only mandatory field of a user definition
  82. password: md5d3d10d8cad606308bdb180148bf663e1 # md5 salted password of 'DBUser.Meta'
  83. optional, plain text and md5 password are both acceptable (prefixed with md5)

  84. login: true # optional, can login, true by default (new biz ROLE should be false)
  85. superuser: false # optional, is superuser? false by default
  86. createdb: false # optional, can create database? false by default
  87. createrole: false # optional, can create role? false by default
  88. inherit: true # optional, can this role use inherited privileges? true by default
  89. replication: false # optional, can this role do replication? false by default
  90. bypassrls: false # optional, can this role bypass row level security? false by default
  91. pgbouncer: true # optional, add this user to pgbouncer user-list? false by default (production user should be true explicitly)
  92. connlimit: -1 # optional, user connection limit, default -1 disable limit
  93. expire_in: 3650 # optional, now + n days when this role is expired (OVERWRITE expire_at)
  94. expire_at: '2030-12-31' # optional, YYYY-MM-DD 'timestamp' when this role is expired (OVERWRITTEN by expire_in)
  95. comment: pigsty admin user # optional, comment string for this user/role
  96. roles: [dbrole_admin] # optional, belonged roles. default roles are: dbrole_{admin,readonly,readwrite,offline}
  97. parameters: {} # optional, role level parameters with ALTER ROLE SET
  98. search_path: public # key value config parameters according to postgresql documentation (e.g: use pigsty as default search_path)

    • {name: dbuser_view ,password: DBUser.Viewer ,pgbouncer: true ,roles: [dbrole_readonly], comment: read-only viewer for meta database}
    • {name: dbuser_grafana ,password: DBUser.Grafana ,pgbouncer: true ,roles: [dbrole_admin] ,comment: admin user for grafana database }
    • {name: dbuser_bytebase ,password: DBUser.Bytebase ,pgbouncer: true ,roles: [dbrole_admin] ,comment: admin user for bytebase database }
    • {name: dbuser_kong ,password: DBUser.Kong ,pgbouncer: true ,roles: [dbrole_admin] ,comment: admin user for kong api gateway }
  99. pg_hba_rules_extra:

    • title: allow grafana bytebase kong intranet access
  100. role: common
  101. rules:
    • host kong dbuser_kong 10.0.0.0/8 md5
    • host bytebase dbuser_bytebase 10.0.0.0/8 md5
    • host grafana dbuser_grafana 10.0.0.0/8 md5
  102. vip_mode: l2

  103. vip_address: 10.10.10.2
  104. vip_cidrmask: 8
  105. vip_interface: eth1
  106. node_crontab:
    • '00 01 * * * postgres /pg/bin/pg-backup 2>>/pg/log/backup.log'
  107. ----------------------------------

  108. pgsql cluster: pg-test (3 nodes)

  109. ----------------------------------

  110. pg-test ---> 10.10.10.3 ---> 10.10.10.1{1,2,3}

  111. pg-test: # define the new 3-node cluster pg-test
  112. hosts:
  113. 10.10.10.11: { pg_seq: 1, pg_role: primary } # primary instance, leader of cluster
  114. 10.10.10.12: { pg_seq: 2, pg_role: replica } # replica instance, follower of leader
  115. 10.10.10.13: { pg_seq: 3, pg_role: replica, pg_offline_query: true } # replica with offline access
  116. vars:
  117. pg_cluster: pg-test # define pgsql cluster name
  118. pg_version: 14 # test postgresql 13 with pg-test cluster
  119. pg_users:
    • name: test
  120. password: test
  121. pgbouncer: true
  122. roles: [ dbrole_admin ]
  123. pg_databases: # create a database and user named 'test'
    • name: test
  124. vip_mode: l2 # enable/disable vip (require members in same LAN)

  125. vip_address: 10.10.10.3 # virtual ip address for this cluster
  126. vip_cidrmask: 8 # cidr network mask length
  127. vip_interface: eth1 # interface to add virtual ip

  128. pg_services_extra: # extra services in addition to pg_services_default, array of service definition

  129. standby service will route {ip|name}:5435 to sync replica's pgbouncer (5435->6432 standby)

    • name: standby # required, service name, the actual svc name will be prefixed with pg_cluster, e.g: pg-meta-standby
  130. src_ip: "*" # required, service bind ip address, * for all ip, vip for cluster vip_address
  131. src_port: 5435 # required, service exposed port (work as kubernetes service node port mode)
  132. dst_port: pgbouncer # optional, destination port, postgres|pgbouncer|<port_number> , pgbouncer(6432) by default
  133. check_method: http # optional, health check method: http is the only available method for now
  134. check_port: patroni # optional, health check port: patroni|pg_exporter|<port_number> , patroni(8008) by default
  135. check_url: /sync # optional, health check url path, /read-only?lag=0 by default
  136. check_code: 200 # optional, health check expected http code, 200 by default
  137. selector: "[]" # required, JMESPath to filter inventory ()
  138. selector_backup: "[? pg_role == primary]" # primary used as backup server for standby service (will not work because /sync for )
  139. haproxy: # optional, adhoc parameters for haproxy service provider (vip_l4 is another service provider)
  140. maxconn: 3000 # optional, max allowed front-end connection
  141. balance: roundrobin # optional, haproxy load balance algorithm (roundrobin by default, other: leastconn)
  142. default_server_options: 'inter 3s fastinter 1s downinter 5s rise 3 fall 3 on-marked-down shutdown-sessions slowstart 30s maxconn 3000 maxqueue 128 weight 100'

  143. ================================================================

  144. REDIS Clusters

  145. ================================================================

  146. ----------------------------------

  147. redis sentinel example

  148. ----------------------------------

  149. redis-meta:
  150. hosts:
  151. 10.10.10.10:
  152. redis_node: 1
  153. redis_instances: { 6001 : {} ,6002 : {} , 6003 : {} }
  154. vars:
  155. redis_cluster: redis-meta
  156. redis_mode: sentinel
  157. redis_max_memory: 64MB

  158. ----------------------------------

  159. redis cluster example

  160. ----------------------------------

  161. redis-test:
  162. hosts:
  163. 10.10.10.11:
  164. redis_node: 1
  165. redis_instances: { 6501 : {} ,6502 : {} ,6503 : {} ,6504 : {} ,6505 : {} ,6506 : {} }
  166. 10.10.10.12:
  167. redis_node: 2
  168. redis_instances: { 6501 : {} ,6502 : {} ,6503 : {} ,6504 : {} ,6505 : {} ,6506 : {} }
  169. vars:
  170. redis_cluster: redis-test # name of this redis 'cluster'
  171. redis_mode: cluster # standalone,cluster,sentinel
  172. redis_max_memory: 32MB # max memory used by each redis instance
  173. redis_mem_policy: allkeys-lru # memory eviction policy

  174. ----------------------------------

  175. redis standalone example

  176. ----------------------------------

  177. redis-common:
  178. hosts:
  179. 10.10.10.13:
  180. redis_node: 1
  181. redis_instances:
  182. 6501: {}
  183. 6502: { replica_of: '10.10.10.13 6501' }
  184. 6503: { replica_of: '10.10.10.13 6501' }
  185. vars:
  186. redis_cluster: redis-common # name of this redis 'cluster'
  187. redis_mode: standalone # standalone,cluster,sentinel
  188. redis_max_memory: 64MB # max memory used by each redis instance

  189. VARS

  190. vars: # global variables
  191. version: v1.5.1 # pigsty version string

  192. ================================================================

  193. VARS: INFRA

  194. ================================================================

  195. -----------------------------------------------------------------

  196. CONNECT

  197. -----------------------------------------------------------------

  198. INSTANCE level ansible connect parameters

  199. ansible_user: vagrant # which user to be used (when connecting to remote nodes)

  200. ansible_port: 22 # which port to be used (when connecting to remote nodes)

  201. ansible_host: meta # ssh alias host name (when connecting to remote nodes)

  202. ansible_ssh_private_key_file: ~/.ssh/id_rsa # ssh private key file

  203. ansible_ssh_common_args: '-o StrictHostKeyChecking=no' # ssh common args

  204. proxy_env: # global proxy env when downloading packages

  205. no_proxy: "localhost,127.0.0.1,10.0.0.0/8,192.168.0.0/16,.pigsty,.aliyun.com,mirrors.,.myqcloud.com,*.tsinghua.edu.cn"
  206. http_proxy: # set your proxy here: e.g http://user:pass@proxy.xxx.com

  207. https_proxy: # set your proxy here: e.g http://user:pass@proxy.xxx.com

  208. all_proxy: # set your proxy here: e.g http://user:pass@proxy.xxx.com

  209. -----------------------------------------------------------------

  210. CA

  211. -----------------------------------------------------------------

  212. ca_method: create # create|copy|recreate
  213. ca_subject: "/CN=root-ca" # self-signed CA subject
  214. ca_homedir: /ca # ca cert directory
  215. ca_cert: ca.crt # ca public key/cert
  216. ca_key: ca.key # ca private key

  217. -----------------------------------------------------------------

  218. NGINX

  219. -----------------------------------------------------------------

  220. nginx_enabled: true # build local repo on this node
  221. nginx_port: 80 # repo listen address, must same as repo_address
  222. nginx_home: /www # default repo home dir

  223. nginx_upstream: # domain names and upstream servers

    • { name: home , domain: pigsty , endpoint: "10.10.10.10:80" }
    • { name: grafana , domain: g.pigsty , endpoint: "10.10.10.10:3000" }
    • { name: loki , domain: l.pigsty , endpoint: "10.10.10.10:3100" }
    • { name: prometheus , domain: p.pigsty , endpoint: "10.10.10.10:9090" }
    • { name: alertmanager , domain: a.pigsty , endpoint: "10.10.10.10:9093" }
    • { name: consul , domain: c.pigsty , endpoint: "127.0.0.1:8500" } #== ^ required ==#
    • { name: postgrest , domain: api.pigsty , endpoint: "127.0.0.1:8884" } #== v optional ==#
    • { name: pgadmin , domain: adm.pigsty , endpoint: "127.0.0.1:8885" }
    • { name: pgweb , domain: cli.pigsty , endpoint: "127.0.0.1:8886" }
    • { name: bytebase , domain: ddl.pigsty , endpoint: "127.0.0.1:8887" }
    • { name: jupyter , domain: lab.pigsty , endpoint: "127.0.0.1:8888" }
    • { name: gitea , domain: git.pigsty , endpoint: "127.0.0.1:8889" }
    • { name: minio , domain: sss.pigsty , endpoint: "127.0.0.1:9000" }
  224. nginx_indexes: # application nav links on home page

    • { name: PgAdmin4 , url : 'http://adm.pigsty' , comment: 'PgAdmin4 for PostgreSQL' }
    • { name: PGWeb , url : 'http://cli.pigsty' , comment: 'PGWEB Browser Client' }
    • { name: ByteBase , url : 'http://ddl.pigsty' , comment: 'ByteBase Schema Migrator' }
    • { name: PostgREST , url : 'http://api.pigsty' , comment: 'Kong API Gateway' }
    • { name: Gitea , url : 'http://git.pigsty' , comment: 'Minio Object Storage' }
    • { name: Minio , url : 'http://sss.pigsty' , comment: 'Minio Object Storage' }
    • { name: Explain , url : '/pev2' , comment: 'postgres explain visualizer' }
    • { name: Package , url : '/pigsty' , comment: 'local yum repo packages' }
    • { name: PG Logs , url : '/logs' , comment: 'postgres raw csv logs' }
    • { name: Schemas , url : '/schema' , comment: 'schemaspy summary report' }
    • { name: Reports , url : '/report' , comment: 'pgbadger summary report' }
    • { name: ISD , url : '${grafana}/d/isd-overview' , comment: 'noaa isd data visualization' }
    • { name: Covid , url : '${grafana}/d/covid-overview' , comment: 'covid data visualization' }
    • { name: Worktime , url : '${grafana}/d/worktime-overview' , comment: 'worktime query' }
    • { name: DBTrend , url : '${grafana}/d/dbeng-trending' , comment: 'DB Engine Trending Graph' }
  225. -----------------------------------------------------------------

  226. REPO

  227. -----------------------------------------------------------------

  228. repo_name: pigsty # repo name, pigsty by default
  229. repo_address: pigsty # external address to this repo (ip:port or url)
  230. repo_rebuild: false # force re-download packages
  231. repo_remove: true # remove existing upstream repo
  232. repo_upstreams: # where to download packages?
    • name: base
  233. description: CentOS-$releasever - Base
  234. gpgcheck: no
  235. baseurl:
    • https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/
    • http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
    • http://mirror.centos.org/centos/$releasever/os/$basearch/
    • name: updates
  236. description: CentOS-$releasever - Updates
  237. gpgcheck: no
  238. baseurl:
    • https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/updates/$basearch/
    • http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
    • http://mirror.centos.org/centos/$releasever/updates/$basearch/
    • name: extras
  239. description: CentOS-$releasever - Extras
  240. baseurl:
    • https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/
    • http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
    • http://mirror.centos.org/centos/$releasever/extras/$basearch/
  241. gpgcheck: no
    • name: epel
  242. description: CentOS $releasever - epel
  243. gpgcheck: no
  244. baseurl:
    • https://mirrors.tuna.tsinghua.edu.cn/epel/$releasever/$basearch
    • http://mirrors.aliyun.com/epel/$releasever/$basearch
    • http://download.fedoraproject.org/pub/epel/$releasever/$basearch
    • name: grafana
  245. description: Grafana Official Yum Repo
  246. enabled: yes
  247. gpgcheck: no
  248. baseurl:
    • https://mirrors.tuna.tsinghua.edu.cn/grafana/yum/rpm
    • https://packages.grafana.com/oss/rpm
    • name: prometheus
  249. description: Prometheus and exporters
  250. gpgcheck: no
  251. baseurl: https://packagecloud.io/prometheus-rpm/release/el/$releasever/$basearch
    • name: pgdg-common
  252. description: PostgreSQL common RPMs for RHEL/CentOS $releasever - $basearch
  253. gpgcheck: no
  254. baseurl:
    • http://mirrors.tuna.tsinghua.edu.cn/postgresql/repos/yum/common/redhat/rhel-$releasever-$basearch
    • https://download.postgresql.org/pub/repos/yum/common/redhat/rhel-$releasever-$basearch
    • name: pgdg14
  255. description: PostgreSQL 14 for RHEL/CentOS $releasever - $basearch
  256. gpgcheck: no
  257. baseurl:
    • https://mirrors.tuna.tsinghua.edu.cn/postgresql/repos/yum/14/redhat/rhel-$releasever-$basearch
    • https://download.postgresql.org/pub/repos/yum/14/redhat/rhel-$releasever-$basearch
    • name: timescaledb
  258. description: TimescaleDB for RHEL/CentOS $releasever - $basearch
  259. gpgcheck: no
  260. baseurl:
    • https://packagecloud.io/timescale/timescaledb/el/7/$basearch
    • name: centos-sclo
  261. description: CentOS-$releasever - SCLo
  262. gpgcheck: no
  263. mirrorlist: http://mirrorlist.centos.org?arch=$basearch&release=$releasever&repo=sclo-sclo

  264. baseurl: http://mirrors.aliyun.com/centos/$releasever/sclo/$basearch/sclo/
    • name: centos-sclo-rh
  265. description: CentOS-$releasever - SCLo rh
  266. gpgcheck: no
  267. mirrorlist: http://mirrorlist.centos.org?arch=$basearch&release=7&repo=sclo-rh

  268. baseurl: http://mirrors.aliyun.com/centos/$releasever/sclo/$basearch/rh/
    • name: nginx
  269. description: Nginx Official Yum Repo
  270. skip_if_unavailable: true
  271. gpgcheck: no
  272. baseurl: http://nginx.org/packages/centos/$releasever/$basearch/
    • name: harbottle # for latest consul & kubernetes
  273. description: Copr repo for main owned by harbottle
  274. skip_if_unavailable: true
  275. gpgcheck: no
  276. baseurl: https://download.copr.fedorainfracloud.org/results/harbottle/main/epel-$releasever-$basearch/
    • name: pg_probackup # for pg_probackup
  277. description: PG_PROBACKUP Centos packages for PostgresPro Standard and Enterprise - $basearch
  278. skip_if_unavailable: true
  279. gpgcheck: no
  280. baseurl: https://repo.postgrespro.ru/pg_probackup-forks/rpm/latest/centos-$releasever-$basearch
    • name: docker-ce # for latest docker
  281. description: Docker CE Stable - $basearch
  282. skip_if_unavailable: true
  283. gpgcheck: no
  284. baseurl:
    • https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/$basearch/stable
    • https://download.docker.com/linux/centos/$releasever/$basearch/stable
  285. repo_packages: # which packages to be included # what to download #

    • epel-release nginx wget yum-utils yum createrepo sshpass zip unzip # ---- boot ---- #
    • ntp chrony uuid lz4 bzip2 nc pv jq vim-enhanced make patch bash lsof wget git tuned perf ftp lrzsz rsync # ---- node ---- #
    • numactl grubby sysstat dstat iotop bind-utils net-tools tcpdump socat ipvsadm telnet ca-certificates keepalived # ----- utils ----- #
    • readline zlib openssl openssh-clients libyaml libxml2 libxslt libevent perl perl-devel perl-ExtUtils* # --- deps:pg --- #
    • readline-devel zlib-devel uuid-devel libuuid-devel libxml2-devel libxslt-devel openssl-devel libicu-devel # --- deps:devel -- #
    • grafana prometheus2 pushgateway alertmanager mtail consul consul_exporter consul-template etcd dnsmasq # ----- meta ----- #
    • node_exporter nginx_exporter blackbox_exporter redis_exporter # ---- exporter --- #
    • ansible python python-pip python-psycopg2 # - ansible & py3 - #
    • python3 python3-psycopg2 python36-requests python3-etcd python3-consul python36-urllib3 python36-idna python36-pyOpenSSL python36-cryptography
    • patroni patroni-consul patroni-etcd pgbouncer pg_cli pgbadger pg_activity tail_n_mail # -- pgsql common - #
    • pgcenter boxinfo check_postgres emaj pgbconsole pg_bloat_check pgquarrel barman barman-cli pgloader pgFormatter pitrery pspg pgxnclient PyGreSQL
    • postgresql14 postgis32_14 citus_14 pglogical_14 timescaledb-2-postgresql-14 pg_repack_14 wal2json_14 # -- pg14 packages -#
    • pg_qualstats_14 pg_stat_kcache_14 pg_stat_monitor_14 pg_top_14 pg_track_settings_14 pg_wait_sampling_14 pg_probackup-std-14
    • pg_statement_rollback_14 system_stats_14 plproxy_14 plsh_14 pldebugger_14 plpgsql_check_14 pgmemcache_14 # plr_14
    • mysql_fdw_14 ogr_fdw_14 tds_fdw_14 sqlite_fdw_14 firebird_fdw_14 hdfs_fdw_14 mongo_fdw_14 osm_fdw_14 pgbouncer_fdw_14
    • hypopg_14 geoip_14 rum_14 hll_14 ip4r_14 prefix_14 pguri_14 tdigest_14 topn_14 periods_14
    • bgw_replstatus_14 count_distinct_14 credcheck_14 ddlx_14 extra_window_functions_14 logerrors_14 mysqlcompat_14 orafce_14
    • repmgr_14 pg_auth_mon_14 pg_auto_failover_14 pg_background_14 pg_bulkload_14 pg_catcheck_14 pg_comparator_14
    • pg_cron_14 pg_fkpart_14 pg_jobmon_14 pg_partman_14 pg_permissions_14 pg_prioritize_14 pgagent_14
    • pgaudit16_14 pgauditlogtofile_14 pgcryptokey_14 pgexportdoc_14 pgfincore_14 pgimportdoc_14 powa_14 pgmp_14 pgq_14
    • pgquarrel-0.7.0-1 pgsql_tweaks_14 pgtap_14 pgtt_14 postgresql-unit_14 postgresql_anonymizer_14 postgresql_faker_14
    • safeupdate_14 semver_14 set_user_14 sslutils_14 table_version_14 # pgrouting_14 osm2pgrouting_14
    • clang coreutils diffutils rpm-build rpm-devel rpmlint rpmdevtools bison flex # gcc gcc-c++ # - build utils - #
    • docker-ce docker-compose kubelet kubectl kubeadm kubernetes-cni helm # - cloud native- #
  286. repo_url_packages: # extra packages from url

    • https://github.com/Vonng/loki-rpm/releases/download/v2.5.0/loki-2.5.0.x86_64.rpm
    • https://github.com/Vonng/loki-rpm/releases/download/v2.5.0/promtail-2.5.0.x86_64.rpm
    • https://github.com/Vonng/pg_exporter/releases/download/v0.5.0/pg_exporter-0.5.0.x86_64.rpm
    • https://github.com/cybertec-postgresql/vip-manager/releases/download/v1.0.2/vip-manager-1.0.2-1.x86_64.rpm
    • https://github.com/Vonng/haproxy-rpm/releases/download/v2.5.7/haproxy-2.5.7-1.el7.x86_64.rpm
    • https://github.com/Vonng/pigsty-pkg/releases/download/misc/redis-6.2.7-1.el7.remi.x86_64.rpm
    • https://github.com/dalibo/pev2/releases/download/v0.24.0/pev2.tar.gz
    • https://github.com/Vonng/pigsty-pkg/releases/download/misc/polysh-0.4-1.noarch.rpm
  287. -----------------------------------------------------------------

  288. NAMESERVER

  289. -----------------------------------------------------------------

  290. nameserver_enabled: false # setup dnsmasq
  291. dns_records: # dynamic dns record resolved by dnsmasq
    • 10.10.10.2 pg-meta # sandbox vip for pg-meta
    • 10.10.10.3 pg-test # sandbox vip for pg-test
    • 10.10.10.10 pg-meta-1 # sandbox instance pg-meta-1
    • 10.10.10.11 pg-test-1 # sandbox instance node-1
    • 10.10.10.12 pg-test-2 # sandbox instance node-2
    • 10.10.10.13 pg-test-3 # sandbox instance node-3
  292. -----------------------------------------------------------------

  293. PROMETHEUS

  294. -----------------------------------------------------------------

  295. prometheus_enabled: true # setup prometheus
  296. prometheus_data_dir: /data/prometheus/data
  297. prometheus_options: '--storage.tsdb.retention=15d'
  298. prometheus_reload: false # reload prometheus instead of recreate it?
  299. prometheus_sd_method: static # service discovery method: static|consul
  300. prometheus_sd_interval: 5s # service discovery refresh interval
  301. prometheus_scrape_interval: 10s # global scrape & evaluation interval
  302. prometheus_scrape_timeout: 8s # scrape timeout

  303. -----------------------------------------------------------------

  304. EXPORTER

  305. -----------------------------------------------------------------

  306. exporter_install: none # none|yum|binary, none by default
  307. exporter_repo_url: '' # if set, repo will be added to /etc/yum.repos.d/
  308. exporter_metrics_path: /metrics # default metric path for pg related exporter

  309. -----------------------------------------------------------------

  310. GRAFANA

  311. -----------------------------------------------------------------

  312. grafana_enabled: true # enable grafana? only works on meta nodes
  313. grafana_endpoint: http://10.10.10.10:3000 # grafana endpoint url
  314. grafana_admin_username: admin # default grafana admin username
  315. grafana_admin_password: pigsty # default grafana admin password
  316. grafana_database: sqlite3 # default grafana database type: sqlite3|postgres
  317. grafana_pgurl: postgres://dbuser_grafana:DBUser.Grafana@meta:5436/grafana

  318. grafana_plugin_method: install # none|install|always, none will skip plugin install

  319. grafana_plugin_cache: /www/pigsty/plugins.tgz # path to grafana plugins cache tarball
  320. grafana_plugin_list: # plugins that will be downloaded via grafana-cli
    • marcusolsson-csv-datasource
    • marcusolsson-json-datasource
    • marcusolsson-treemap-panel
  321. grafana_plugin_git: # plugins that will be downloaded via git
    • https://github.com/Vonng/vonng-echarts-panel
  322. -----------------------------------------------------------------

  323. LOKI

  324. -----------------------------------------------------------------

  325. loki_enabled: true # enable loki? only works on meta nodes
  326. loki_clean: false # whether remove existing loki data
  327. loki_endpoint: http://10.10.10.10:3100/loki/api/v1/push # where to push data
  328. loki_options: '-config.file=/etc/loki.yml -config.expand-env=true'
  329. loki_data_dir: /data/loki # default loki data dir
  330. loki_retention: 15d # log retention period

  331. -----------------------------------------------------------------

  332. DCS

  333. -----------------------------------------------------------------

  334. dcs_name: pigsty # consul dc name
  335. dcs_servers: # dcs server dict in name:ip format
  336. meta-1: 10.10.10.10 # using existing external dcs cluster is recommended for HA
  337. meta-2: 10.10.10.11 # node with ip in dcs_servers will be initialized as dcs servers

  338. meta-3: 10.10.10.12 # it's recommend to reuse meta nodes as dcs servers if no ad hoc cluster available

  339. dcs_registry: consul # where to register services: none | consul | etcd | both
  340. dcs_safeguard: false # if true, running dcs will NOT be removed
  341. dcs_clean: true # if true, running dcs will be purged during node init, DANGEROUS

  342. -----------------------------------------------------------------

  343. CONSUL

  344. -----------------------------------------------------------------

  345. consul_enabled: true # enable consul server/agent by default?
  346. consul_data_dir: /data/consul # consul data dir (/data/consul by default)

  347. -----------------------------------------------------------------

  348. ETCD

  349. -----------------------------------------------------------------

  350. etcd_enabled: true # enable etcd server by default?
  351. etcd_data_dir: /data/etcd # etcd data dir (/data/etcd by default)

  352. ================================================================

  353. VARS: NODES

  354. ================================================================

  355. global variables for nodes (including meta)

  356. -----------------------------------------------------------------

  357. NODE_IDENTITY

  358. -----------------------------------------------------------------

  359. meta_node: false # node with meta_node flag will be marked as admin node
  360. nodename: # [OPTIONAL] # node instance identity, used as ins, hostname by default

  361. node_cluster: nodes # [OPTIONAL] # node cluster identity, used as cls, 'nodes' by default
  362. nodename_overwrite: true # overwrite node's hostname with nodename?
  363. nodename_exchange: false # exchange nodename among play hosts?

  364. -----------------------------------------------------------------

  365. NODE_DNS

  366. -----------------------------------------------------------------

  367. node_etc_hosts_default: # static dns records in /etc/hosts
    • 10.10.10.10 meta pigsty p.pigsty g.pigsty a.pigsty c.pigsty l.pigsty
    • 10.10.10.10 api.pigsty adm.pigsty cli.pigsty ddl.pigsty lab.pigsty git.pigsty sss.pigsty
  368. node_etc_hosts: [] # extra static dns records in /etc/hosts

  369. node_dns_method: add # add (default) | none (skip) | overwrite (remove old settings)

  370. node_dns_servers: # dynamic nameserver in /etc/resolv.conf
    • 10.10.10.10
  371. node_dns_options: # dns resolv options
    • options single-request-reopen timeout:1 rotate
    • domain service.consul
  372. -----------------------------------------------------------------

  373. NODE_REPO

  374. -----------------------------------------------------------------

  375. node_repo_method: local # none|local: ad local repo|public: add upstream directly
  376. node_repo_remove: true # remove existing repo on nodes?
  377. node_repo_local_urls: # list local repo url, if node_repo_method = local
    • http://pigsty/pigsty.repo
  378. node_packages: [ ] # extra packages for all nodes

  379. node_packages_default: # common packages for all nodes
    • wget,sshpass,ntp,chrony,tuned,uuid,lz4,make,patch,bash,lsof,wget,unzip,git,ftp,vim-minimal,ca-certificates
    • numactl,grubby,sysstat,dstat,iotop,bind-utils,net-tools,tcpdump,socat,ipvsadm,telnet,tuned,nc,pv,jq,perf
    • readline,zlib,openssl,openssl-libs,openssh-clients,python3,python36-requests,node_exporter,consul,etcd,promtail
  380. node_packages_meta: # extra packages for meta nodes
    • grafana,prometheus2,alertmanager,loki,nginx_exporter,blackbox_exporter,pushgateway,redis,postgresql14
    • nginx,ansible,pgbadger,python-psycopg2,dnsmasq,coreutils,diffutils,polysh,docker-ce,docker-compose
  381. node_packages_meta_pip: jupyterlab

  382. -----------------------------------------------------------------

  383. NODE_TUNE

  384. -----------------------------------------------------------------

  385. node_disable_firewall: true # disable firewall
  386. node_disable_selinux: true # disable selinux
  387. node_disable_numa: false # disable numa (node reboot required)
  388. node_disable_swap: false # disable swap, use with caution
  389. node_static_network: true # keep dns resolver settings after reboot
  390. node_disk_prefetch: false # setup disk prefetch on HDD to increase performance
  391. node_kernel_modules: [ softdog, br_netfilter, ip_vs, ip_vs_rr, ip_vs_rr, ip_vs_wrr, ip_vs_sh ]
  392. node_tune: tiny # install and activate tuned profile: none|oltp|olap|crit|tiny
  393. node_sysctl_params: { } # set additional sysctl parameters, k:v format

  394. -----------------------------------------------------------------

  395. NODE_ADMIN

  396. -----------------------------------------------------------------

  397. node_data_dir: /data # main data directory
  398. node_admin_enabled: true # create a default admin user defined by node_admin_* ?
  399. node_admin_uid: 88 # uid and gid for this admin user
  400. node_admin_username: dba # name of this admin user, dba by default
  401. node_admin_ssh_exchange: true # exchange admin ssh key among each pgsql cluster ?
  402. node_admin_pk_current: true # add current user's ~/.ssh/id_rsa.pub to admin authorized_keys ?
  403. node_admin_pk_list: # ssh public keys to be added to admin user (REPLACE WITH YOURS!)
    • 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQC7IMAMNavYtWwzAJajKqwdn3ar5BhvcwCnBTxxEkXhGlCO2vfgosSAQMEflfgvkiI5nM1HIFQ8KINlx1XLO7SdL5KdInG5LIJjAFh0pujS4kNCT9a5IGvSq1BrzGqhbEcwWYdju1ZPYBcJm/MG+JD0dYCh8vfrYB/cYMD0SOmNkQ== vagrant@pigsty.com'
  404. -----------------------------------------------------------------

  405. NODE_TIME

  406. -----------------------------------------------------------------

  407. node_timezone: Asia/Hong_Kong # default node timezone, empty will not change
  408. node_ntp_enabled: true # enable ntp service? false will leave ntp service untouched
  409. node_ntp_service: ntp # ntp service provider: ntp|chrony
  410. node_ntp_servers: # default NTP servers
    • pool cn.pool.ntp.org iburst
    • pool pool.ntp.org iburst
    • pool time.pool.aliyun.com iburst
    • server 10.10.10.10 iburst
    • server ntp.tuna.tsinghua.edu.cn iburst
  411. node_crontab_overwrite: true # true will overwrite /etc/crontab, false will append crontab
  412. node_crontab: [ ] # crontab entries in /etc/crontab

  413. -----------------------------------------------------------------

  414. DOCKER

  415. -----------------------------------------------------------------

  416. docker_enabled: false # enable docker on all nodes? (you can enable them on meta nodes only)
  417. docker_cgroups_driver: systemd # docker cgroup fs driver
  418. docker_registry_mirrors: [] # docker registry mirror
  419. docker_image_cache: /tmp/docker.tgz # docker images tarball to be loaded if exists

  420. -----------------------------------------------------------------

  421. NODE_EXPORTER

  422. -----------------------------------------------------------------

  423. node_exporter_enabled: true # setup node_exporter on instance
  424. node_exporter_port: 9100 # default port for node exporter
  425. node_exporter_options: '--no-collector.softnet --no-collector.nvme --collector.ntp --collector.tcpstat --collector.processes'

  426. -----------------------------------------------------------------

  427. PROMTAIL

  428. -----------------------------------------------------------------

  429. promtail_enabled: true # enable promtail logging collector?
  430. promtail_clean: false # remove promtail status file? false by default
  431. promtail_port: 9080 # default listen address for promtail
  432. promtail_options: '-config.file=/etc/promtail.yml -config.expand-env=true'
  433. promtail_positions: /var/log/positions.yaml # position status for promtail

  434. ================================================================

  435. VARS: PGSQL

  436. ================================================================

  437. -----------------------------------------------------------------

  438. PG_IDENTITY

  439. -----------------------------------------------------------------

  440. pg_cluster: # <CLUSTER> <REQUIRED> : pgsql cluster name

  441. pg_role: replica # <INSTANCE> <REQUIRED> : pg role : primary, replica, offline

  442. pg_seq: 0 # <INSTANCE> <REQUIRED> : instance seq number

  443. pg_instances: {} # <INSTANCE> : define multiple pg instances on node, used by monly & gpsql

  444. pg_upstream: # <INSTANCE> : replication upstream ip addr

  445. pg_shard: # <CLUSTER> : pgsql shard name

  446. pg_sindex: 0 # <CLUSTER> : pgsql shard index

  447. gp_role: master # <CLUSTER> : gpsql role, master or segment

  448. pg_offline_query: false # <INSTANCE> [FLAG] set to true to enable offline query on this instance (instance level)

  449. pg_backup: false # <INSTANCE> [FLAG] store base backup on this node (instance level, reserved)
  450. pg_weight: 100 # <INSTANCE> [FLAG] default load balance weight (instance level)
  451. pg_hostname: true # [FLAG] reuse postgres identity name as node identity?
  452. pg_preflight_skip: false # [FLAG] skip preflight identity check

  453. -----------------------------------------------------------------

  454. PG_BUSINESS

  455. -----------------------------------------------------------------

  456. overwrite these variables on <CLUSTER> level

  457. pg_users: [] # business users
  458. pg_databases: [] # business databases
  459. pg_services_extra: [] # extra services
  460. pg_hba_rules_extra: [] # extra hba rules
  461. pgbouncer_hba_rules_extra: [] # extra pgbouncer hba rules

  462. WARNING: change these in production environment!

  463. pg_admin_username: dbuser_dba
  464. pg_admin_password: DBUser.DBA
  465. pg_monitor_username: dbuser_monitor
  466. pg_monitor_password: DBUser.Monitor
  467. pg_replication_username: replicator
  468. pg_replication_password: DBUser.Replicator

  469. -----------------------------------------------------------------

  470. PG_INSTALL

(本文超出站点单文档体积上限,已截断)