Auto:默认单机模板

非沙箱环境下单机安装Pigsty时,默认使用此配置模板

  1. ---
  2. ######################################################################
  3. # File : pigsty.yml
  4. # Desc : Pigsty singleton meta auto-generated config template
  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. ######################################################################
  10. all:
  11. ##################################################################
  12. # CLUSTERS #
  13. ##################################################################
  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. ##################################################################
  20. children: # groups definition
  21. #================================================================#
  22. # Meta Nodes: Admin Controller #
  23. #================================================================#
  24. meta: # meta nodes are defined in this special group "meta"
  25. vars:
  26. meta_node: true # mark this group as meta nodes
  27. ansible_group_priority: 99 # overwrite with the highest priority
  28. nginx_enabled: true # setup repo & underlying nginx
  29. nameserver_enabled: false # setup dnsmasq
  30. prometheus_enabled: true # setup prometheus
  31. grafana_enabled: true # setup grafana
  32. loki_enabled: true # setup loki
  33. docker_enabled: true # setup docker
  34. dcs_safeguard: false # protect dcs server from fat fingers
  35. hosts: # add nodes to group 'meta'
  36. 10.10.10.10: { }
  37. # 10.10.10.11: { nginx_enabled: false }
  38. # 10.10.10.12: { nginx_enabled: false }
  39. #================================================================#
  40. #================================================================#
  41. # PGSQL Clusters #
  42. #================================================================#
  43. #----------------------------------#
  44. # pgsql cluster: pg-meta (CMDB) #
  45. #----------------------------------#
  46. pg-meta:
  47. hosts: { 10.10.10.10: { pg_seq: 1, pg_role: primary , pg_offline_query: true } }
  48. vars:
  49. pg_cluster: pg-meta
  50. patroni_watchdog_mode: off
  51. pg_databases:
  52. - { name: meta, baseline: cmdb.sql , schemas: [ pigsty ] , extensions: [ { name: adminpack, schema: pg_catalog } , { name: postgis, schema: public } , { name: timescaledb } ] ,comment: pigsty meta database }
  53. pg_users:
  54. - {name: dbuser_meta ,password: DBUser.Meta ,pgbouncer: true ,roles: [dbrole_admin] ,comment: pigsty cmdb admin user }
  55. - {name: dbuser_view ,password: DBUser.Viewer ,pgbouncer: true ,roles: [dbrole_readonly] ,comment: read-only viewer for meta database }
  56. node_crontab:
  57. - '00 01 * * * postgres /pg/bin/pg-backup 2>>/pg/log/backup.log'
  58. #----------------------------------#
  59. # pgsql cluster: pg-test (example) #
  60. #----------------------------------#
  61. #pg-test:
  62. # hosts:
  63. # 10.10.10.11: { pg_seq: 1, pg_role: primary }
  64. # 10.10.10.12: { pg_seq: 2, pg_role: replica }
  65. # 10.10.10.13: { pg_seq: 3, pg_role: replica, pg_offline_query: true }
  66. # vars:
  67. # pg_cluster: pg-test
  68. # pg_users: [ { name: test , password: test , pgbouncer: true , roles: [ dbrole_admin ] , comment: test user } ]
  69. # pg_databases: [ { name: test , extensions: [ { name: postgis, schema: public } ] } ]
  70. ####################################################################
  71. # VARS #
  72. ####################################################################
  73. vars: # global variables
  74. version: v1.5.1 # pigsty version string
  75. #================================================================#
  76. # VARS: INFRA #
  77. #================================================================#
  78. #-----------------------------------------------------------------
  79. # CONNECT
  80. #-----------------------------------------------------------------
  81. # INSTANCE level ansible connect parameters
  82. # ansible_user: vagrant # which user to be used (when connecting to remote nodes)
  83. # ansible_port: 22 # which port to be used (when connecting to remote nodes)
  84. # ansible_host: meta # ssh alias host name (when connecting to remote nodes)
  85. # ansible_ssh_private_key_file: ~/.ssh/id_rsa # ssh private key file
  86. # ansible_ssh_common_args: '-o StrictHostKeyChecking=no' # ssh common args
  87. proxy_env: # global proxy env when downloading packages
  88. 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"
  89. # http_proxy: # set your proxy here: e.g http://user:pass@proxy.xxx.com
  90. # https_proxy: # set your proxy here: e.g http://user:pass@proxy.xxx.com
  91. # all_proxy: # set your proxy here: e.g http://user:pass@proxy.xxx.com
  92. #-----------------------------------------------------------------
  93. # CA
  94. #-----------------------------------------------------------------
  95. ca_method: create # create|copy|recreate
  96. ca_subject: "/CN=root-ca" # self-signed CA subject
  97. ca_homedir: /ca # ca cert directory
  98. ca_cert: ca.crt # ca public key/cert
  99. ca_key: ca.key # ca private key
  100. #-----------------------------------------------------------------
  101. # NGINX
  102. #-----------------------------------------------------------------
  103. nginx_enabled: true # build local repo on this node
  104. nginx_port: 80 # repo listen address, must same as repo_address
  105. nginx_home: /www # default repo home dir
  106. nginx_upstream: # domain names and upstream servers
  107. - { name: home , domain: pigsty , endpoint: "10.10.10.10:80" }
  108. - { name: grafana , domain: g.pigsty , endpoint: "10.10.10.10:3000" }
  109. - { name: loki , domain: l.pigsty , endpoint: "10.10.10.10:3100" }
  110. - { name: prometheus , domain: p.pigsty , endpoint: "10.10.10.10:9090" }
  111. - { name: alertmanager , domain: a.pigsty , endpoint: "10.10.10.10:9093" }
  112. - { name: consul , domain: c.pigsty , endpoint: "127.0.0.1:8500" }
  113. nginx_indexes: # application nav links on home page
  114. - { name: Explain , url : '/pev2' , comment: 'postgres explain visualizer' }
  115. - { name: Package , url : '/pigsty' , comment: 'local yum repo packages' }
  116. - { name: PG Logs , url : '/logs' , comment: 'postgres raw csv logs' }
  117. - { name: Schemas , url : '/schema' , comment: 'schemaspy summary report' }
  118. - { name: Reports , url : '/report' , comment: 'pgbadger summary report' }
  119. #-----------------------------------------------------------------
  120. # REPO
  121. #-----------------------------------------------------------------
  122. repo_name: pigsty # repo name, pigsty by default
  123. repo_address: pigsty # external address to this repo (ip:port or url)
  124. repo_rebuild: false # force re-download packages
  125. repo_remove: true # remove existing upstream repo
  126. repo_upstreams: # where to download packages?
  127. - name: base
  128. description: CentOS-$releasever - Base
  129. gpgcheck: no
  130. baseurl:
  131. - https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/
  132. - http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
  133. - http://mirror.centos.org/centos/$releasever/os/$basearch/
  134. - name: updates
  135. description: CentOS-$releasever - Updates
  136. gpgcheck: no
  137. baseurl:
  138. - https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/updates/$basearch/
  139. - http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
  140. - http://mirror.centos.org/centos/$releasever/updates/$basearch/
  141. - name: extras
  142. description: CentOS-$releasever - Extras
  143. baseurl:
  144. - https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/
  145. - http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
  146. - http://mirror.centos.org/centos/$releasever/extras/$basearch/
  147. gpgcheck: no
  148. - name: epel
  149. description: CentOS $releasever - epel
  150. gpgcheck: no
  151. baseurl:
  152. - https://mirrors.tuna.tsinghua.edu.cn/epel/$releasever/$basearch
  153. - http://mirrors.aliyun.com/epel/$releasever/$basearch
  154. - http://download.fedoraproject.org/pub/epel/$releasever/$basearch
  155. - name: grafana
  156. description: Grafana Official Yum Repo
  157. enabled: yes
  158. gpgcheck: no
  159. baseurl:
  160. - https://mirrors.tuna.tsinghua.edu.cn/grafana/yum/rpm
  161. - https://packages.grafana.com/oss/rpm
  162. - name: prometheus
  163. description: Prometheus and exporters
  164. gpgcheck: no
  165. baseurl: https://packagecloud.io/prometheus-rpm/release/el/$releasever/$basearch
  166. - name: pgdg-common
  167. description: PostgreSQL common RPMs for RHEL/CentOS $releasever - $basearch
  168. gpgcheck: no
  169. baseurl:
  170. - http://mirrors.tuna.tsinghua.edu.cn/postgresql/repos/yum/common/redhat/rhel-$releasever-$basearch
  171. - https://download.postgresql.org/pub/repos/yum/common/redhat/rhel-$releasever-$basearch
  172. - name: pgdg14
  173. description: PostgreSQL 14 for RHEL/CentOS $releasever - $basearch
  174. gpgcheck: no
  175. baseurl:
  176. - https://mirrors.tuna.tsinghua.edu.cn/postgresql/repos/yum/14/redhat/rhel-$releasever-$basearch
  177. - https://download.postgresql.org/pub/repos/yum/14/redhat/rhel-$releasever-$basearch
  178. - name: timescaledb
  179. description: TimescaleDB for RHEL/CentOS $releasever - $basearch
  180. gpgcheck: no
  181. baseurl:
  182. - https://packagecloud.io/timescale/timescaledb/el/7/$basearch
  183. - name: centos-sclo
  184. description: CentOS-$releasever - SCLo
  185. gpgcheck: no
  186. #mirrorlist: http://mirrorlist.centos.org?arch=$basearch&release=$releasever&repo=sclo-sclo
  187. baseurl: http://mirrors.aliyun.com/centos/$releasever/sclo/$basearch/sclo/
  188. - name: centos-sclo-rh
  189. description: CentOS-$releasever - SCLo rh
  190. gpgcheck: no
  191. #mirrorlist: http://mirrorlist.centos.org?arch=$basearch&release=7&repo=sclo-rh
  192. baseurl: http://mirrors.aliyun.com/centos/$releasever/sclo/$basearch/rh/
  193. - name: nginx
  194. description: Nginx Official Yum Repo
  195. skip_if_unavailable: true
  196. gpgcheck: no
  197. baseurl: http://nginx.org/packages/centos/$releasever/$basearch/
  198. - name: harbottle # for latest consul & kubernetes
  199. description: Copr repo for main owned by harbottle
  200. skip_if_unavailable: true
  201. gpgcheck: no
  202. baseurl: https://download.copr.fedorainfracloud.org/results/harbottle/main/epel-$releasever-$basearch/
  203. - name: pg_probackup # for pg_probackup
  204. description: PG_PROBACKUP Centos packages for PostgresPro Standard and Enterprise - $basearch
  205. skip_if_unavailable: true
  206. gpgcheck: no
  207. baseurl: https://repo.postgrespro.ru/pg_probackup-forks/rpm/latest/centos-$releasever-$basearch
  208. - name: docker-ce # for latest docker
  209. description: Docker CE Stable - $basearch
  210. skip_if_unavailable: true
  211. gpgcheck: no
  212. baseurl:
  213. - https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/$basearch/stable
  214. - https://download.docker.com/linux/centos/$releasever/$basearch/stable
  215. repo_packages: # which packages to be included # what to download #
  216. - epel-release nginx wget yum-utils yum createrepo sshpass zip unzip # ---- boot ---- #
  217. - ntp chrony uuid lz4 bzip2 nc pv jq vim-enhanced make patch bash lsof wget git tuned perf ftp lrzsz rsync # ---- node ---- #
  218. - numactl grubby sysstat dstat iotop bind-utils net-tools tcpdump socat ipvsadm telnet ca-certificates keepalived # ----- utils ----- #
  219. - readline zlib openssl openssh-clients libyaml libxml2 libxslt libevent perl perl-devel perl-ExtUtils* # --- deps:pg --- #
  220. - readline-devel zlib-devel uuid-devel libuuid-devel libxml2-devel libxslt-devel openssl-devel libicu-devel # --- deps:devel -- #
  221. - grafana prometheus2 pushgateway alertmanager mtail consul consul_exporter consul-template etcd dnsmasq # ----- meta ----- #
  222. - node_exporter nginx_exporter blackbox_exporter redis_exporter # ---- exporter --- #
  223. - ansible python python-pip python-psycopg2 # - ansible & py3 - #
  224. - python3 python3-psycopg2 python36-requests python3-etcd python3-consul python36-urllib3 python36-idna python36-pyOpenSSL python36-cryptography
  225. - patroni patroni-consul patroni-etcd pgbouncer pg_cli pgbadger pg_activity tail_n_mail # -- pgsql common - #
  226. - pgcenter boxinfo check_postgres emaj pgbconsole pg_bloat_check pgquarrel barman barman-cli pgloader pgFormatter pitrery pspg pgxnclient PyGreSQL
  227. - postgresql14* postgis32_14* citus_14* pglogical_14* timescaledb-2-postgresql-14 pg_repack_14 wal2json_14 # -- pg14 packages -#
  228. - 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
  229. - pg_statement_rollback_14 system_stats_14 plproxy_14 plsh_14 pldebugger_14 plpgsql_check_14 pgmemcache_14 # plr_14
  230. - 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
  231. - hypopg_14 geoip_14 rum_14 hll_14 ip4r_14 prefix_14 pguri_14 tdigest_14 topn_14 periods_14
  232. - bgw_replstatus_14 count_distinct_14 credcheck_14 ddlx_14 extra_window_functions_14 logerrors_14 mysqlcompat_14 orafce_14
  233. - repmgr_14 pg_auth_mon_14 pg_auto_failover_14 pg_background_14 pg_bulkload_14 pg_catcheck_14 pg_comparator_14
  234. - pg_cron_14 pg_fkpart_14 pg_jobmon_14 pg_partman_14 pg_permissions_14 pg_prioritize_14 pgagent_14
  235. - pgaudit16_14 pgauditlogtofile_14 pgcryptokey_14 pgexportdoc_14 pgfincore_14 pgimportdoc_14 powa_14 pgmp_14 pgq_14
  236. - pgquarrel-0.7.0-1 pgsql_tweaks_14 pgtap_14 pgtt_14 postgresql-unit_14 postgresql_anonymizer_14 postgresql_faker_14
  237. - safeupdate_14 semver_14 set_user_14 sslutils_14 table_version_14 # pgrouting_14 osm2pgrouting_14
  238. - clang coreutils diffutils rpm-build rpm-devel rpmlint rpmdevtools bison flex # gcc gcc-c++ # - build utils - #
  239. - docker-ce docker-compose kubelet kubectl kubeadm kubernetes-cni helm # - cloud native- #
  240. repo_url_packages: # extra packages from url
  241. - https://github.com/Vonng/loki-rpm/releases/download/v2.5.0/loki-2.5.0.x86_64.rpm
  242. - https://github.com/Vonng/loki-rpm/releases/download/v2.5.0/promtail-2.5.0.x86_64.rpm
  243. - https://github.com/Vonng/pg_exporter/releases/download/v0.5.0/pg_exporter-0.5.0.x86_64.rpm
  244. - https://github.com/cybertec-postgresql/vip-manager/releases/download/v1.0.2/vip-manager-1.0.2-1.x86_64.rpm
  245. - https://github.com/Vonng/haproxy-rpm/releases/download/v2.5.7/haproxy-2.5.7-1.el7.x86_64.rpm
  246. - https://github.com/Vonng/pigsty-pkg/releases/download/misc/redis-6.2.7-1.el7.remi.x86_64.rpm
  247. - https://github.com/dalibo/pev2/releases/download/v0.24.0/pev2.tar.gz
  248. - https://github.com/Vonng/pigsty-pkg/releases/download/misc/polysh-0.4-1.noarch.rpm
  249. #-----------------------------------------------------------------
  250. # NAMESERVER
  251. #-----------------------------------------------------------------
  252. nameserver_enabled: false # setup dnsmasq
  253. dns_records: # dynamic dns record resolved by dnsmasq
  254. - 10.10.10.10 pg-meta # sandbox vip for pg-meta
  255. - 10.10.10.10 pg-meta-1 # sandbox instance pg-meta-1
  256. #-----------------------------------------------------------------
  257. # PROMETHEUS
  258. #-----------------------------------------------------------------
  259. prometheus_enabled: true # setup prometheus
  260. prometheus_data_dir: /data/prometheus/data
  261. prometheus_options: '--storage.tsdb.retention=15d'
  262. prometheus_reload: false # reload prometheus instead of recreate it?
  263. prometheus_sd_method: static # service discovery method: static|consul
  264. prometheus_sd_interval: 5s # service discovery refresh interval
  265. prometheus_scrape_interval: 10s # global scrape & evaluation interval
  266. prometheus_scrape_timeout: 8s # scrape timeout
  267. #-----------------------------------------------------------------
  268. # EXPORTER
  269. #-----------------------------------------------------------------
  270. exporter_install: none # none|yum|binary, none by default
  271. exporter_repo_url: '' # if set, repo will be added to /etc/yum.repos.d/
  272. exporter_metrics_path: /metrics # default metric path for pg related exporter
  273. #-----------------------------------------------------------------
  274. # GRAFANA
  275. #-----------------------------------------------------------------
  276. grafana_enabled: true # enable grafana? only works on meta nodes
  277. grafana_endpoint: http://10.10.10.10:3000 # grafana endpoint url
  278. grafana_admin_username: admin # default grafana admin username
  279. grafana_admin_password: pigsty # default grafana admin password
  280. grafana_database: sqlite3 # default grafana database type: sqlite3|postgres
  281. grafana_pgurl: postgres://dbuser_grafana:DBUser.Grafana@meta:5436/grafana
  282. grafana_plugin_method: install # none|install|always, none will skip plugin install
  283. grafana_plugin_cache: /www/pigsty/plugins.tgz # path to grafana plugins cache tarball
  284. grafana_plugin_list: # plugins that will be downloaded via grafana-cli
  285. - marcusolsson-csv-datasource
  286. - marcusolsson-json-datasource
  287. - marcusolsson-treemap-panel
  288. grafana_plugin_git: # plugins that will be downloaded via git
  289. - https://github.com/Vonng/vonng-echarts-panel
  290. #-----------------------------------------------------------------
  291. # LOKI
  292. #-----------------------------------------------------------------
  293. loki_enabled: true # enable loki? only works on meta nodes
  294. loki_clean: false # whether remove existing loki data
  295. loki_endpoint: http://10.10.10.10:3100/loki/api/v1/push # where to push data
  296. loki_options: '-config.file=/etc/loki.yml -config.expand-env=true'
  297. loki_data_dir: /data/loki # default loki data dir
  298. loki_retention: 15d # log retention period
  299. #-----------------------------------------------------------------
  300. # DCS
  301. #-----------------------------------------------------------------
  302. dcs_name: pigsty # consul dc name
  303. dcs_servers: # dcs server dict in name:ip format
  304. meta-1: 10.10.10.10 # using existing external dcs cluster is recommended for HA
  305. # meta-2: 10.10.10.11 # node with ip in dcs_servers will be initialized as dcs servers
  306. # meta-3: 10.10.10.12 # it's recommend to reuse meta nodes as dcs servers if no ad hoc cluster available
  307. dcs_registry: consul # where to register services: none | consul | etcd | both
  308. dcs_safeguard: false # if true, running dcs will NOT be removed
  309. dcs_clean: false # if true, running dcs will be purged during node init, DANGEROUS
  310. #-----------------------------------------------------------------
  311. # CONSUL
  312. #-----------------------------------------------------------------
  313. consul_enabled: true # enable consul server/agent by default?
  314. consul_data_dir: /data/consul # consul data dir (/data/consul by default)
  315. #-----------------------------------------------------------------
  316. # ETCD
  317. #-----------------------------------------------------------------
  318. etcd_enabled: true # enable etcd server by default?
  319. etcd_data_dir: /data/etcd # etcd data dir (/data/etcd by default)
  320. #================================================================#
  321. # VARS: NODES #
  322. #================================================================#
  323. # global variables for nodes (including meta)
  324. #-----------------------------------------------------------------
  325. # NODE_IDENTITY
  326. #-----------------------------------------------------------------
  327. meta_node: false # node with meta_node flag will be marked as admin node
  328. # nodename: # [OPTIONAL] # node instance identity, used as `ins`, hostname by default
  329. node_cluster: nodes # [OPTIONAL] # node cluster identity, used as `cls`, 'nodes' by default
  330. nodename_overwrite: true # overwrite node's hostname with nodename?
  331. nodename_exchange: false # exchange nodename among play hosts?
  332. #-----------------------------------------------------------------
  333. # NODE_DNS
  334. #-----------------------------------------------------------------
  335. node_etc_hosts_default: # static dns records in /etc/hosts
  336. - 10.10.10.10 meta pigsty p.pigsty g.pigsty a.pigsty c.pigsty l.pigsty
  337. - 10.10.10.10 api.pigsty adm.pigsty cli.pigsty ddl.pigsty lab.pigsty git.pigsty sss.pigsty
  338. node_etc_hosts: [] # extra static dns records in /etc/hosts
  339. node_dns_method: none # add (default) | none (skip) | overwrite (remove old settings)
  340. node_dns_servers: # dynamic nameserver in /etc/resolv.conf
  341. - 10.10.10.10
  342. node_dns_options: # dns resolv options
  343. - options single-request-reopen timeout:1 rotate
  344. - domain service.consul
  345. #-----------------------------------------------------------------
  346. # NODE_REPO
  347. #-----------------------------------------------------------------
  348. node_repo_method: local # none|local: ad local repo|public: add upstream directly
  349. node_repo_remove: true # remove existing repo on nodes?
  350. node_repo_local_urls: # list local repo url, if node_repo_method = local
  351. - http://pigsty/pigsty.repo
  352. node_packages: [ ] # extra packages for all nodes
  353. node_packages_default: # common packages for all nodes
  354. - wget,sshpass,ntp,chrony,tuned,uuid,lz4,make,patch,bash,lsof,wget,unzip,git,ftp,vim-minimal,ca-certificates
  355. - numactl,grubby,sysstat,dstat,iotop,bind-utils,net-tools,tcpdump,socat,ipvsadm,telnet,tuned,nc,pv,jq,perf
  356. - readline,zlib,openssl,openssl-libs,openssh-clients,python3,python36-requests,node_exporter,consul,etcd,promtail
  357. node_packages_meta: # extra packages for meta nodes
  358. - grafana,prometheus2,alertmanager,loki,nginx_exporter,blackbox_exporter,pushgateway,redis,postgresql14
  359. - nginx,ansible,pgbadger,python-psycopg2,dnsmasq,coreutils,diffutils,polysh,docker-ce,docker-compose
  360. node_packages_meta_pip: jupyterlab
  361. #-----------------------------------------------------------------
  362. # NODE_TUNE
  363. #-----------------------------------------------------------------
  364. node_disable_firewall: true # disable firewall
  365. node_disable_selinux: true # disable selinux
  366. node_disable_numa: false # disable numa (node reboot required)
  367. node_disable_swap: false # disable swap, use with caution
  368. node_static_network: true # keep dns resolver settings after reboot
  369. node_disk_prefetch: false # setup disk prefetch on HDD to increase performance
  370. node_kernel_modules: [ softdog, br_netfilter, ip_vs, ip_vs_rr, ip_vs_rr, ip_vs_wrr, ip_vs_sh ]
  371. node_tune: tiny # install and activate tuned profile: none|oltp|olap|crit|tiny
  372. node_sysctl_params: { } # set additional sysctl parameters, k:v format
  373. #-----------------------------------------------------------------
  374. # NODE_ADMIN
  375. #-----------------------------------------------------------------
  376. node_data_dir: /data # main data directory
  377. node_admin_enabled: true # create a default admin user defined by `node_admin_*` ?
  378. node_admin_uid: 88 # uid and gid for this admin user
  379. node_admin_username: dba # name of this admin user, dba by default
  380. node_admin_ssh_exchange: true # exchange admin ssh key among each pgsql cluster ?
  381. node_admin_pk_current: true # add current user's ~/.ssh/id_rsa.pub to admin authorized_keys ?
  382. node_admin_pk_list: [ ] # ssh public keys to be added to admin user (REPLACE WITH YOURS!)
  383. #-----------------------------------------------------------------
  384. # NODE_TIME
  385. #-----------------------------------------------------------------
  386. node_timezone: Asia/Hong_Kong # default node timezone, empty will not change
  387. node_ntp_enabled: false # enable ntp service? false will leave ntp service untouched
  388. node_ntp_service: ntp # ntp service provider: ntp|chrony
  389. node_ntp_servers: # default NTP servers
  390. - pool cn.pool.ntp.org iburst
  391. - pool pool.ntp.org iburst
  392. - pool time.pool.aliyun.com iburst
  393. - server 10.10.10.10 iburst
  394. - server ntp.tuna.tsinghua.edu.cn iburst
  395. node_crontab_overwrite: true # true will overwrite /etc/crontab, false will append crontab
  396. node_crontab: [ ] # crontab entries in /etc/crontab
  397. #-----------------------------------------------------------------
  398. # DOCKER
  399. #-----------------------------------------------------------------
  400. docker_enabled: false # enable docker on all nodes? (you can enable them on meta nodes only)
  401. docker_cgroups_driver: systemd # docker cgroup fs driver
  402. docker_registry_mirrors: [] # docker registry mirror
  403. docker_image_cache: /tmp/docker.tgz # docker images tarball to be loaded if exists
  404. #-----------------------------------------------------------------
  405. # NODE_EXPORTER
  406. #-----------------------------------------------------------------
  407. node_exporter_enabled: true # setup node_exporter on instance
  408. node_exporter_port: 9100 # default port for node exporter
  409. node_exporter_options: '--no-collector.softnet --no-collector.nvme --collector.ntp --collector.tcpstat --collector.processes'
  410. #-----------------------------------------------------------------
  411. # PROMTAIL
  412. #-----------------------------------------------------------------
  413. promtail_enabled: true # enable promtail logging collector?
  414. promtail_clean: false # remove promtail status file? false by default
  415. promtail_port: 9080 # default listen address for promtail
  416. promtail_options: '-config.file=/etc/promtail.yml -config.expand-env=true'
  417. promtail_positions: /var/log/positions.yaml # position status for promtail
  418. #================================================================#
  419. # VARS: PGSQL #
  420. #================================================================#
  421. #-----------------------------------------------------------------
  422. # PG_IDENTITY
  423. #-----------------------------------------------------------------
  424. # pg_cluster: # <CLUSTER> <REQUIRED> : pgsql cluster name
  425. # pg_role: replica # <INSTANCE> <REQUIRED> : pg role : primary, replica, offline
  426. # pg_seq: 0 # <INSTANCE> <REQUIRED> : instance seq number
  427. # pg_instances: {} # <INSTANCE> : define multiple pg instances on node, used by monly & gpsql
  428. # pg_upstream: # <INSTANCE> : replication upstream ip addr
  429. # pg_shard: # <CLUSTER> : pgsql shard name
  430. # pg_sindex: 0 # <CLUSTER> : pgsql shard index
  431. # gp_role: master # <CLUSTER> : gpsql role, master or segment
  432. pg_offline_query: false # <INSTANCE> [FLAG] set to true to enable offline query on this instance (instance level)
  433. pg_backup: false # <INSTANCE> [FLAG] store base backup on this node (instance level, reserved)
  434. pg_weight: 100 # <INSTANCE> [FLAG] default load balance weight (instance level)
  435. pg_hostname: true # [FLAG] reuse postgres identity name as node identity?
  436. pg_preflight_skip: false # [FLAG] skip preflight identity check
  437. #-----------------------------------------------------------------
  438. # PG_BUSINESS
  439. #-----------------------------------------------------------------
  440. # overwrite these variables on <CLUSTER> level
  441. pg_users: [] # business users
  442. pg_databases: [] # business databases
  443. pg_services_extra: [] # extra services
  444. pg_hba_rules_extra: [] # extra hba rules
  445. pgbouncer_hba_rules_extra: [] # extra pgbouncer hba rules
  446. # WARNING: change these in production environment!
  447. pg_admin_username: dbuser_dba
  448. pg_admin_password: DBUser.DBA
  449. pg_monitor_username: dbuser_monitor
  450. pg_monitor_password: DBUser.Monitor
  451. pg_replication_username: replicator
  452. pg_replication_password: DBUser.Replicator
  453. #-----------------------------------------------------------------
  454. # PG_INSTALL
  455. #-----------------------------------------------------------------
  456. pg_dbsu: postgres # os user for database, postgres by default (unwise to change it)
  457. pg_dbsu_uid: 26 # os dbsu uid and gid, 26 for default postgres users and groups
  458. pg_dbsu_sudo: limit # dbsu sudo privilege: none|limit|all|nopass, limit by default
  459. pg_dbsu_home: /var/lib/pgsql # postgresql home directory
  460. pg_dbsu_ssh_exchange: false # exchange postgres dbsu ssh key among same cluster ?
  461. pg_version: 14 # default postgresql version to be installed
  462. pgdg_repo: false # add pgdg official repo before install (in case of no local repo available)
  463. pg_add_repo: false # add postgres relate repo before install ?
  464. pg_bin_dir: /usr/pgsql/bin # postgres binary dir, default is /usr/pgsql/bin, which use /usr/pgsql -> /usr/pgsql-{ver}
  465. pg_packages: # postgresql related packages. `${pg_version} will be replaced by `pg_version`
  466. - postgresql${pg_version}* # postgresql kernel packages
  467. - postgis32_${pg_version}* # postgis
  468. - citus_${pg_version}* # citus
  469. - timescaledb-2-postgresql-${pg_version} # timescaledb
  470. - pgbouncer pg_exporter pgbadger pg_activity node_exporter consul haproxy vip-manager
  471. - patroni patroni-consul patroni-etcd python3 python3-psycopg2 python36-requests python3-etcd
  472. - python3-consul python36-urllib3 python36-idna python36-pyOpenSSL python36-cryptography
  473. pg_extensions: # postgresql extensions, `${pg_version} will be replaced by actual `pg_version`
  474. - pg_repack_${pg_version} pg_qualstats_${pg_version} pg_stat_kcache_${pg_version} pg_stat_monitor_${pg_version} wal2json_${pg_version}
  475. # - ogr_fdw${pg_version} mysql_fdw_${pg_version} redis_fdw_${pg_version} mongo_fdw${pg_version} hdfs_fdw_${pg_version}
  476. # - count_distinct${version} ddlx_${version} geoip${version} orafce${version}
  477. # - hypopg_${version} ip4r${version} jsquery_${version} logerrors_${version} periods_${version} pg_auto_failover_${version} pg_catcheck${version}
  478. # - pg_fkpart${version} pg_jobmon${version} pg_partman${version} pg_prioritize_${version} pg_track_settings${version} pgaudit15_${version}
  479. # - pgcryptokey${version} pgexportdoc${version} pgimportdoc${version} pgmemcache-${version} pgmp${version} pgq-${version} pgquarrel pgrouting_${version}
  480. # - pguint${version} pguri${version} prefix${version} safeupdate_${version} semver${version} table_version${version} tdigest${version}
  481. #-----------------------------------------------------------------
  482. # PG_BOOTSTRAP
  483. #-----------------------------------------------------------------
  484. pg_safeguard: false # true will disable pg_clean at all, even for pgsql-remove.yml
  485. pg_clean: false # true will clean running postgres during pgsql init (DANGEROUS)
  486. pg_data: /pg/data # postgres data directory (soft link)
  487. pg_fs_main: /data # primary data disk mount point /pg -> {{ pg_fs_main }}/postgres/{{ pg_instance }}
  488. pg_fs_bkup: /data/backups # backup disk mount point /pg/* -> {{ pg_fs_bkup }}/postgres/{{ pg_instance }}/*
  489. pg_dummy_filesize: 64MiB # /pg/dummy hold some disk space for emergency use
  490. pg_listen: '0.0.0.0' # postgres listen address, '0.0.0.0' (all ipv4 addr) by default
  491. pg_port: 5432 # postgres port, 5432 by default
  492. pg_localhost: /var/run/postgresql # localhost unix socket dir for connection
  493. patroni_enabled: true # if not enabled, no postgres cluster will be created
  494. patroni_mode: default # pause|default|remove
  495. pg_dcs_type: consul # which dcs to use: consul or etcd or raft
  496. pg_namespace: /pg # top level key namespace in dcs
  497. patroni_port: 8008 # default patroni port
  498. patroni_watchdog_mode: automatic # watchdog mode: off|automatic|required
  499. pg_conf: tiny.yml # pgsql template: {oltp|olap|crit|tiny}.yml
  500. pg_libs: 'timescaledb, pg_stat_statements, auto_explain' # extensions to be loaded
  501. pg_delay: 0 # apply delay for standby cluster leader
  502. pg_checksum: false # enable data checksum by default
  503. pg_encoding: UTF8 # database cluster encoding, UTF8 by default
  504. pg_locale: C # database cluster local, C by default
  505. pg_lc_collate: C # database cluster collate, C by default
  506. pg_lc_ctype: en_US.UTF8 # database character type, en_US.UTF8 by default (for i18n full-text search)
  507. pgbouncer_enabled: true # if not enabled, pgbouncer will not be created
  508. pgbouncer_port: 6432 # pgbouncer port, 6432 by default
  509. pgbouncer_poolmode: transaction # pooling mode: session|transaction|statement, transaction pooling by default
  510. pgbouncer_max_db_conn: 100 # max connection to single database, DO NOT set this larger than postgres max conn or db connlimit
  511. #-----------------------------------------------------------------
  512. # PG_PROVISION
  513. #-----------------------------------------------------------------
  514. pg_provision: true # whether provisioning postgres cluster
  515. pg_init: pg-init # init script for cluster template
  516. pg_default_roles:
  517. - { name: dbrole_readonly , login: false , comment: role for global read-only access } # production read-only role
  518. - { name: dbrole_readwrite , login: false , roles: [dbrole_readonly], comment: role for global read-write access } # production read-write role
  519. - { name: dbrole_offline , login: false , comment: role for restricted read-only access (offline instance) } # restricted-read-only role
  520. - { name: dbrole_admin , login: false , roles: [pg_monitor, dbrole_readwrite] , comment: role for object creation } # production DDL change role
  521. - { name: postgres , superuser: true , comment: system superuser } # system dbsu, name is designated by `pg_dbsu`
  522. - { name: dbuser_dba , superuser: true , roles: [dbrole_admin] , comment: system admin user } # admin dbsu, name is designated by `pg_admin_username`
  523. - { name: replicator , replication: true , bypassrls: true , roles: [pg_monitor, dbrole_readonly] , comment: system replicator } # replicator
  524. - { name: dbuser_monitor , roles: [pg_monitor, dbrole_readonly] , comment: system monitor user , parameters: {log_min_duration_statement: 1000 } } # monitor user
  525. - { name: dbuser_stats , password: DBUser.Stats , roles: [dbrole_offline] , comment: business offline user for offline queries and ETL } # ETL user
  526. pg_default_privileges: # - privileges - #
  527. - GRANT USAGE ON SCHEMAS TO dbrole_readonly
  528. - GRANT SELECT ON TABLES TO dbrole_readonly
  529. - GRANT SELECT ON SEQUENCES TO dbrole_readonly
  530. - GRANT EXECUTE ON FUNCTIONS TO dbrole_readonly
  531. - GRANT USAGE ON SCHEMAS TO dbrole_offline
  532. - GRANT SELECT ON TABLES TO dbrole_offline
  533. - GRANT SELECT ON SEQUENCES TO dbrole_offline
  534. - GRANT EXECUTE ON FUNCTIONS TO dbrole_offline
  535. - GRANT INSERT, UPDATE, DELETE ON TABLES TO dbrole_readwrite
  536. - GRANT USAGE, UPDATE ON SEQUENCES TO dbrole_readwrite
  537. - GRANT TRUNCATE, REFERENCES, TRIGGER ON TABLES TO dbrole_admin
  538. - GRANT CREATE ON SCHEMAS TO dbrole_admin
  539. pg_default_schemas: [ monitor ] # default schemas to be created
  540. pg_default_extensions: # default extensions to be created
  541. - { name: 'pg_stat_statements', schema: 'monitor' }
  542. - { name: 'pgstattuple', schema: 'monitor' }
  543. - { name: 'pg_qualstats', schema: 'monitor' }
  544. - { name: 'pg_buffercache', schema: 'monitor' }
  545. - { name: 'pageinspect', schema: 'monitor' }
  546. - { name: 'pg_prewarm', schema: 'monitor' }
  547. - { name: 'pg_visibility', schema: 'monitor' }
  548. - { name: 'pg_freespacemap', schema: 'monitor' }
  549. - { name: 'pg_repack', schema: 'monitor' }
  550. - name: postgres_fdw
  551. - name: file_fdw
  552. - name: btree_gist
  553. - name: btree_gin
  554. - name: pg_trgm
  555. - name: intagg
  556. - name: intarray
  557. pg_reload: true # reload postgres after hba changes
  558. pg_hba_rules: # postgres host-based authentication rules
  559. - title: allow meta node password access
  560. role: common
  561. rules:
  562. - host all all 10.10.10.10/32 md5
  563. - title: allow intranet admin password access
  564. role: common
  565. rules:
  566. - host all +dbrole_admin 10.0.0.0/8 md5
  567. - host all +dbrole_admin 172.16.0.0/12 md5
  568. - host all +dbrole_admin 192.168.0.0/16 md5
  569. - title: allow intranet password access
  570. role: common
  571. rules:
  572. - host all all 10.0.0.0/8 md5
  573. - host all all 172.16.0.0/12 md5
  574. - host all all 192.168.0.0/16 md5
  575. - title: allow local read/write (local production user via pgbouncer)
  576. role: common
  577. rules:
  578. - local all +dbrole_readonly md5
  579. - host all +dbrole_readonly 127.0.0.1/32 md5
  580. - title: allow offline query (ETL,SAGA,Interactive) on offline instance
  581. role: offline
  582. rules:
  583. - host all +dbrole_offline 10.0.0.0/8 md5
  584. - host all +dbrole_offline 172.16.0.0/12 md5
  585. - host all +dbrole_offline 192.168.0.0/16 md5
  586. pgbouncer_hba_rules: # pgbouncer host-based authentication rules
  587. - title: local password access
  588. role: common
  589. rules:
  590. - local all all md5
  591. - host all all 127.0.0.1/32 md5
  592. - title: intranet password access
  593. role: common
  594. rules:
  595. - host all all 10.0.0.0/8 md5
  596. - host all all 172.16.0.0/12 md5
  597. - host all all 192.168.0.0/16 md5
  598. #-----------------------------------------------------------------
  599. # PG_EXPORTER
  600. #-----------------------------------------------------------------
  601. pg_exporter_enabled: true # setup pg_exporter on instance
  602. pg_exporter_config: pg_exporter.yml # use fast cache exporter for demo
  603. pg_exporter_port: 9630 # pg_exporter listen port
  604. pg_exporter_params: 'sslmode=disable' # url query parameters for pg_exporter
  605. pg_exporter_url: '' # optional, overwrite auto-generate postgres connstr
  606. pg_exporter_auto_discovery: true # optional, discovery available database on target instance ?
  607. pg_exporter_exclude_database: 'template0,template1,postgres' # optional, comma separated list of database that WILL NOT be monitored when auto-discovery enabled
  608. pg_exporter_include_database: '' # optional, comma separated list of database that WILL BE monitored when auto-discovery enabled, empty string will disable include mode
  609. pg_exporter_options: '--log.level=info --log.format="logger:syslog?appname=pg_exporter&local=7"'
  610. pgbouncer_exporter_enabled: true # setup pgbouncer_exporter on instance (if you don't have pgbouncer, disable it)
  611. pgbouncer_exporter_port: 9631 # pgbouncer_exporter listen port
  612. pgbouncer_exporter_url: '' # optional, overwrite auto-generate pgbouncer connstr
  613. pgbouncer_exporter_options: '--log.level=info --log.format="logger:syslog?appname=pgbouncer_exporter&local=7"'
  614. #-----------------------------------------------------------------
  615. # PG_SERVICE
  616. #-----------------------------------------------------------------
  617. pg_services: # how to expose postgres service in cluster?
  618. - name: primary # service name {{ pg_cluster }}-primary
  619. src_ip: "*"
  620. src_port: 5433
  621. dst_port: pgbouncer # 5433 route to pgbouncer
  622. check_url: /primary # primary health check, success when instance is primary
  623. selector: "[]" # select all instance as primary service candidate
  624. - name: replica # service name {{ pg_cluster }}-replica
  625. src_ip: "*"
  626. src_port: 5434
  627. dst_port: pgbouncer
  628. check_url: /read-only # read-only health check. (including primary)
  629. selector: "[]" # select all instance as replica service candidate
  630. selector_backup: "[? pg_role == `primary` || pg_role == `offline` ]"
  631. - name: default # service's actual name is {{ pg_cluster }}-default
  632. src_ip: "*" # service bind ip address, * for all, vip for cluster virtual ip address
  633. src_port: 5436 # bind port, mandatory
  634. dst_port: postgres # target port: postgres|pgbouncer|port_number , pgbouncer(6432) by default
  635. check_method: http # health check method: only http is available for now
  636. check_port: patroni # health check port: patroni|pg_exporter|port_number , patroni by default
  637. check_url: /primary # health check url path, / as default
  638. check_code: 200 # health check http code, 200 as default
  639. selector: "[]" # instance selector
  640. haproxy: # haproxy specific fields
  641. maxconn: 3000 # default front-end connection
  642. balance: roundrobin # load balance algorithm (roundrobin by default)
  643. 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'
  644. - name: offline # service name {{ pg_cluster }}-offline
  645. src_ip: "*"
  646. src_port: 5438
  647. dst_port: postgres
  648. check_url: /replica # offline MUST be a replica
  649. selector: "[? pg_role == `offline` || pg_offline_query ]" # instances with pg_role == 'offline' or instance marked with 'pg_offline_query == true'
  650. selector_backup: "[? pg_role == `replica` && !pg_offline_query]" # replica are used as backup server in offline service
  651. haproxy_enabled: true # enable haproxy on this node?
  652. haproxy_reload: true # reload haproxy after config?
  653. haproxy_auth_enabled: false # enable authentication for haproxy admin?
  654. haproxy_admin_username: admin # default haproxy admin username
  655. haproxy_admin_password: pigsty # default haproxy admin password
  656. haproxy_exporter_port: 9101 # default admin/exporter port
  657. haproxy_client_timeout: 24h # client side connection timeout
  658. haproxy_server_timeout: 24h # server side connection timeout
  659. vip_mode: none # none | l2 | l4 , l4 not implemented yet
  660. vip_reload: true # reload vip after config?
  661. # vip_address: 127.0.0.1 # virtual ip address ip (l2 or l4)
  662. # vip_cidrmask: 24 # virtual ip address cidr mask (l2 only)
  663. # vip_interface: eth0 # virtual ip network interface (l2 only)
  664. # dns_mode: vip # vip|all|selector: how to resolve cluster DNS?
  665. # dns_selector: '[]' # if dns_mode == vip, filter instances been resolved
  666. #================================================================#
  667. # VARS: REDIS #
  668. #================================================================#
  669. # REDIS are not enabled by default
  670. #-----------------------------------------------------------------
  671. # REDIS_IDENTITY
  672. #-----------------------------------------------------------------
  673. #redis_cluster: redis-test # name of this redis cluster @ cluster level
  674. #redis_node: 1 # redis node identifier, integer sequence @ node level
  675. #redis_instances: {} # redis instances definition of this redis node @ node level
  676. #-----------------------------------------------------------------
  677. # REDIS_NODE
  678. #-----------------------------------------------------------------
  679. redis_fs_main: /data # main fs mountpoint for redis data
  680. redis_exporter_enabled: true # install redis exporter on redis nodes?
  681. redis_exporter_port: 9121 # default port for redis exporter
  682. redis_exporter_options: '' # default cli args for redis exporter
  683. #-----------------------------------------------------------------
  684. # REDIS_PROVISION
  685. #-----------------------------------------------------------------
  686. redis_safeguard: false # force redis_clean = abort if true
  687. redis_clean: true # abort|skip|clean if redis server already exists
  688. redis_rmdata: true # remove redis data when purging redis server?
  689. redis_mode: standalone # standalone,cluster,sentinel
  690. redis_conf: redis.conf # config template path (except sentinel)
  691. redis_bind_address: '0.0.0.0' # bind address, empty string turns to inventory_hostname
  692. redis_max_memory: 1GB # max memory used by each redis instance
  693. redis_mem_policy: allkeys-lru # memory eviction policy
  694. redis_password: '' # masterauth & requirepass password, disable by empty string
  695. redis_rdb_save: ['1200 1'] # redis rdb save directives, disable with empty list
  696. redis_aof_enabled: false # redis aof enabled
  697. redis_rename_commands: {} # rename dangerous commands
  698. redis_cluster_replicas: 1 # how many replicas for a master in redis cluster ?
  699. ...

最后修改 2022-06-18: v1.5.1 (8de4142)