PostgreSQL
带有 437 扩展的原版 PostgreSQL 内核
PostgreSQL 是世界上最先进和最受欢迎的开源数据库。
Pigsty 支持 PostgreSQL 13 ~ 18,并提供 437 PG 扩展。
快速开始
./configure -c pgsql # 使用 postgres 内核
./install.yml # 使用 pigsty 设置一切大多数配置模板默认使用 PostgreSQL 内核,例如:
meta: 默认,带有核心扩展(vector、postgis、timescale)的 postgresrich: 安装了所有扩展的 postgresslim: 仅 postgres,无监控基础设施full: 用于 HA 演示的 4 节点沙盒pgsql: 最小的 postgres 内核配置示例
配置
原版 PostgreSQL 内核不需要特殊调整:
pg-meta:
hosts:
10.10.10.10: { pg_seq: 1, pg_role: primary }
vars:
pg_cluster: pg-meta
pg_users:
- { name: dbuser_meta ,password: DBUser.Meta ,pgbouncer: true ,roles: [dbrole_admin ] ,comment: pigsty admin user }
- { name: dbuser_view ,password: DBUser.Viewer ,pgbouncer: true ,roles: [dbrole_readonly] ,comment: read-only viewer }
pg_databases:
- { name: meta, baseline: cmdb.sql ,comment: pigsty meta database ,schemas: [pigsty] ,extensions: [ vector ]}
pg_hba_rules:
- { user: dbuser_view , db: all ,addr: infra ,auth: pwd ,title: 'allow grafana dashboard access cmdb from infra nodes' }
node_crontab: [ '00 01 * * * postgres /pg/bin/pg-backup full' ] # 每天凌晨 1 点进行全量备份
pg_packages: [ pgsql-main, pgsql-common ] # pg 内核和通用工具
#pg_extensions: [ pg18-time ,pg18-gis ,pg18-rag ,pg18-fts ,pg18-olap ,pg18-feat ,pg18-lang ,pg18-type ,pg18-util ,pg18-func ,pg18-admin ,pg18-stat ,pg18-sec ,pg18-fdw ,pg18-sim ,pg18-etl]要使用不同的 PostgreSQL 主版本,您可以使用 -v 参数进行配置:
./configure -c pgsql # 默认就是 postgresql 18,无需显式指定
./configure -c pgsql -v 17 # 使用 postgresql 17
./configure -c pgsql -v 16 # 使用 postgresql 16
./configure -c pgsql -v 15 # 使用 postgresql 15
./configure -c pgsql -v 14 # 使用 postgresql 14
./configure -c pgsql -v 13 # 使用 postgresql 13如果 PostgreSQL 集群已经安装,您需要在安装新版本之前卸载它
./pgsql-rm.yml # -l pg-meta