Pigsty v4.2.2 | PostgreSQL RDS/DBaaS | Apache-2.0
- EN Docs: https://pigsty.io/docs
- CN Docs: https://pigsty.cc/docs
- Expert Support: https://pigsty.io/price (rh@vonng.com)
pigsty.yml, source of truth of this deployment, always read it to understand current environment.
Sometimes the real state may drift from the config file, especially after manual changes / failover. trust by verify.
files/pki/ca/ca.key - highly sensitive CA private key. Keep it safe, never share it, don't lose it.
If pig cli is available, you can use it to perform operation command with caution. https://pigsty.io/docs/pig
- Identify scope: Which cluster? Which nodes?
- Check current state:
pig pg list, system status - Verify backup:
pig pb info- is backup recent? - Dry run first: Add
--checkto playbook
- Confirm with user - even in YOLO mode
- Verify backup exists and is recent
- Ask user to type exact target name
- Execute with explicit
-llimit flag
- Read logs first, understand the situation, you can get it from
/pg/log, or query victorialogs API - Check Patroni/HA status
- Do NOT take any action without user confirmation
- Recommend rollback/recovery options before executing
Read-only operations:
- Read
pigsty.ymlconfiguration file - Read Ansible inventory and playbook files
- Read system monitoring metrics (CPU, memory, disk, network)
- Read PostgreSQL/Patroni cluster status via
pg list,patronictl - Read backup status via
pb info,pgbackrest info - Read service status via
systemctl status - Read logs:
/pg/log/, system journal, nginx access logs - Query monitoring dashboards and Grafana metrics
- Dry-run playbooks with
--checkflag - Read extension catalog and documentation
Diagnostic commands:
pig pg list <cluster>- Patroni cluster statuspig pb info- Backup information- System health:
df,free,uptime,ps,top, etc.
Cluster lifecycle operations:
pgsql.yml- Initialize PostgreSQL clusterpgsql-user.yml- Create/modify userspgsql-db.yml- Create/modify databasesnode.yml- Provision nodesinfra.yml- Deploy infrastructure- Any playbook execution without
--check
Configuration changes:
- Modify
pigsty.yml - Change
pg_hba.confor HBA rules - Modify PostgreSQL parameters
- Change Patroni configuration
- Update haproxy/vip configuration
Service operations:
- Restart PostgreSQL/Patroni services
- Reload configuration (
pg_reload_conf()) - Switchover primary/replica (
pg switchover) - Backup execution (
pg-backup)
Destructive operations - require explicit confirmation + backup verification:
Running Ansible playbooks, especially init/remove playbooks, always requires explicit user consent and permission, even in YOLO mode. Improper use may cause data loss! Your policy should be deny-by-default unless the user explicitly authorizes and requests. If you believe the user doesn't fully understand what they're doing, you should pause execution, explain and clarify further, and only proceed after confirming the user truly understands what they're about to do.
NEVER execute without user saying "yes, I confirm":
- pgsql-rm.yml # Remove PostgreSQL cluster
- node-rm.yml # Remove node from cluster
- infra-rm.yml # Remove infrastructure
- redis-rm.yml # Remove Redis cluster
- etcd-rm.yml # Remove etcd cluster
- minio-rm.yml # Remove MinIO cluster
- DROP DATABASE # Delete database
- DROP TABLE # Delete table
- TRUNCATE # Clear table data
- DELETE without WHERE # Mass deletion
- rm -rf /pg/* # Delete data directories
- rm -rf ~/pigsty # Delete Pigsty installation
- rm pigsty.yml # Delete configuration
- rm -rf files/pki # Delete PKI certificates
- patronictl remove # Remove cluster member
- pg_ctl stop -m immediate # Force stop
Must verify before any destructive operation:
- Ask: "Which cluster/database/table?"
- Ask: "Do you have a recent backup?"
- Ask: "Type the exact name to confirm"
Default policy: DO NOT read business data without permission
You may NOT execute these without explicit user consent:
SELECT * FROM <user_tables>- Read application data tables
- Export or dump business data
- Access data in
/pg/data/directly
Allowed for diagnostics (system tables only):
pg_stat_*viewspg_catalog.*system catalogsinformation_schema.*- Extension metadata tables
If user needs data analysis:
- Ask which tables/data are needed
- Confirm user authorizes access
- Limit query scope (use LIMIT, specific columns)
- Never store or transmit sensitive data
- English: https://pigsty.io/docs
- Chinese: https://pigsty.cc/docs
Use pigsty.io for English queries, pigsty.cc for Chinese queries.
Project information including features, history, licensing, roadmap, and community resources.
feature.md- Complete feature overview and capabilities of Pigstyhistory.md- Project history and version evolutionlicense.md- Apache 2.0 licensing information and termsroadmap.md- Future development plans and upcoming featurescase.md- Real-world use cases and success storiescommunity.md- Community resources, discussions, and contribution guidelinescompare/- Comparisons with other database solutions and cloud RDS offerings
Core concepts explaining Pigsty's architecture, high availability design, backup/recovery mechanisms, and security compliance. Essential reading for understanding how Pigsty works under the hood.
arch/- System architecture documentation covering PostgreSQL cluster design, node topology, and infrastructure componentsmodel/- Cluster model definitions for each module type (pgsql, infra, etcd, redis, minio)iac/- Infrastructure as Code principles and implementationinventory.md- Ansible inventory structure and how to define your infrastructureparameter.md- Parameter hierarchy and precedence rulesconfigure.md- Configuration generation process using the configure script
ha/- High availability concepts and implementation detailsrto.md- Recovery Time Objective analysis and guaranteesrpo.md- Recovery Point Objective and data loss preventionfailure/- Failure scenario handling (active failures, passive failures, manual intervention, network partitions)
pitr/- Point-in-time recovery concepts and how pgBackRest enables time-travel for your datasec/- Security architecture including access control levels, CA/PKI infrastructure, and authentication mechanismsmonitor.md- Observability stack design with VictoriaMetrics, Grafana, and alerting
Quick start guide for single-node deployments. Follow these docs to get Pigsty running on your laptop or a single server within minutes.
install.md- Standard installation procedure with online package downloadsoffline.md- Air-gapped installation using pre-downloaded offline packagesslim.md- Minimal installation without full monitoring stack for resource-constrained environmentsconfig.md- Configuration walkthrough explaining key parameters to customizeplaybook.md- How to execute Ansible playbooks and understand their outputsecurity.md- Security considerations for initial deploymentwebui.md- Accessing Grafana dashboards, Prometheus, and other web interfacespgsql.md- Connecting to PostgreSQL using psql, pgAdmin, and application driversdocker.md- Alternative Docker-based deployment method
Production deployment guide for multi-node, highly available clusters. Use these docs when deploying Pigsty in serious production environments.
planning.md- Architecture planning including node sizing, network topology, and resource allocationprepare.md- Pre-deployment checklist covering OS preparation, SSH access, and privilege requirementsinstall.md- Step-by-step production installation with HA PostgreSQL clusterssandbox.md- Setting up sandbox environments for testing and developmentvagrant.md- Vagrant templates for local multi-node testing clustersterraform.md- Terraform templates for cloud infrastructure provisioning (AWS, GCP, Azure)admin.md- Admin node setup and configuration management best practicessecurity.md- Production security hardening including SSL/TLS, firewall rules, and access controls
Quick reference documentation for looking up specific technical details. Bookmark these pages for day-to-day operations.
linux.md- Supported Linux distributions and version compatibility matrixmodule.md- Complete module reference with dependencies and relationshipsparam.md- Comprehensive parameter reference listing all configuration options with defaults and descriptionsplaybook.md- Ansible playbook reference with all available playbooks, tags, and execution examplesport.md- Port allocation table showing all services and their default portsfhs.md- Filesystem hierarchy standard explaining directory structure and file locationsextension.md- Complete catalog of 451+ PostgreSQL extensions with installation instructions
Application templates for deploying containerized software on top of Pigsty infrastructure. Each app comes with Docker Compose configuration and integration guides.
nocodb.md,teable.md- No-code database platforms for building applications without programminggitea.md- Self-hosted Git service similar to GitHub/GitLabwiki.md- Wiki and documentation platformsmattermost.md- Team collaboration and messaging platformmaybe.md- Personal finance management applicationmetabase.md- Business intelligence and analytics dashboardkong.md- API gateway for microservices architecturejupyter.md- Jupyter Notebook for data science and machine learningbytebase.md- Database DevOps and schema migration platformpgadmin.md- PostgreSQL graphical administration toolsupabase.md- Open source Firebase alternative backend platform
Ready-to-use configuration templates for various deployment scenarios. Copy and customize these for your specific needs.
Single-node templates: meta.md, rich.md, fat.md, slim.md, infra.md - Various single-node configurations from minimal to feature-rich
Kernel templates: pgsql.md, citus.md, polar.md, oriole.md, mysql.md, mssql.md - Templates for different PostgreSQL variants and compatibility layers
HA templates: dual.md, trio.md, full.md, safe.md, simu.md - Multi-node high availability configurations from 2-node to full production
Application templates: odoo.md, dify.md, teable.md, supabase.md, registry.md - Pre-configured templates for specific applications
Demo templates: demo.md, el.md, debian.md, oss.md, minio.md - Demonstration and testing configurations
The core PostgreSQL module documentation. This is the most important section for database administrators managing PostgreSQL clusters with Pigsty.
Cluster configuration and definition. Learn how to declare PostgreSQL clusters, users, databases, and access rules in pigsty.yml.
cluster.md- Cluster topology definition including primary, replicas, and instance placementkernel.md- PostgreSQL kernel version selection and variant configurationuser.md- User and role definitions with privilege managementdb.md- Database definitions including templates, extensions, and schemashba.md- Host-based authentication rules controlling client accessacl.md- Fine-grained access control lists for database objectsalias.md- SQL command aliases for convenience
Service exposure and access patterns. Explains how clients connect to PostgreSQL through HAProxy, VIP, and DNS.
PostgreSQL security configuration including SSL/TLS, authentication methods, and encryption.
Day-to-day administration operations. The essential guide for cluster lifecycle management.
cluster.md- Cluster lifecycle management including creation, scaling, and removal proceduresuser.md- Runtime user management with CREATE/ALTER/DROP operationsdb.md- Database administration including creation, configuration, and maintenancehba.md- HBA rule management and reload proceduresupgrade.md- PostgreSQL major and minor version upgrade procedurescomponent.md- Managing cluster components (Patroni, pgBouncer, HAProxy)monitor.md- Monitoring configuration and troubleshootingpatroni.md- Patroni-specific operations including switchover, failover, and maintenance modepgbackrest.md- Backup administration with pgBackRest commands and schedulingpgbouncer.md- Connection pooler management and configurationext.md- Extension management including installation, updates, and removalcrontab.md- Scheduled task configuration for maintenance operations
Backup and recovery operations with pgBackRest. Critical documentation for data protection.
mechanism.md- How PostgreSQL backup works including WAL archiving and base backupspolicy.md- Backup retention policies and scheduling strategiesrepository.md- Backup repository configuration for local, S3, and MinIO storageadmin.md- Backup administration commands and monitoringrestore.md- Point-in-time recovery procedures and disaster recoverycluster.md- Cluster-level backup coordination and consistency
Data migration guides for moving data between PostgreSQL versions and from other databases.
Hands-on tutorials for common operational tasks. Step-by-step guides with real examples.
drill.md- Operational drills for practicing failover and recoverydrop.md- Safe procedures for dropping databases, tables, and clustersfailure.md- Failure scenario handling and recovery procedurespitr.md- Point-in-time recovery tutorial with practical exampleshugepage.md- Linux huge pages configuration for improved performancepg-fork.md- Using PostgreSQL forks and variants (Citus, PolarDB, etc.)pg-vip.md- Virtual IP configuration for high availabilitycitus.md- Citus distributed PostgreSQL setup and operations
Monitoring system configuration and dashboard usage.
dashboard.md- Overview of available Grafana dashboardsdashboard/overview/- System-wide overview dashboardsdashboard/cluster/- Cluster-level monitoring dashboardsdashboard/instance/- Instance-level detailed metricsdashboard/database/- Database-specific performance dashboards
Complete PGSQL module parameter reference. All configuration options with descriptions and defaults.
PostgreSQL extension management. Pigsty supports 451+ extensions out of the box.
start.md- Quick start guide for extension installationintro.md- Introduction to PostgreSQL extension ecosystempkg.md- Extension packaging and distributiondownload.md- Downloading extensions from repositoriesinstall.md- Installing extensions on PostgreSQL clustersconfig.md- Configuring extensions with shared_preload_libraries and other settingscreate.md- Creating extensions in databases with CREATE EXTENSIONextension.md- Detailed extension catalog and compatibility informationrepo.md- Extension repository managementremove.md- Safely removing extensions from databasesupdate.md- Updating extensions to newer versions
Performance tuning templates for different workload types.
oltp.md- OLTP template optimized for transactional workloads with low latencyolap.md- OLAP template optimized for analytical queries and large scanscrit.md- Critical/financial template with maximum durability and consistencytiny.md- Tiny instance template for development and resource-constrained environmentstune.md- Manual tuning guide for custom performance optimization
PostgreSQL kernel variants and forks supported by Pigsty.
postgres.md- Vanilla PostgreSQL from the official PostgreSQL Global Development Groupcitus.md- Citus distributed PostgreSQL for horizontal scalingbabelfish.md- WiltonDB/Babelfish for SQL Server protocol compatibilityivorysql.md- IvorySQL with Oracle PL/SQL compatibilityopenhalo.md- OpenHalo distributed databasepercona.md- Percona Distribution for PostgreSQL with enterprise featuresorioledb.md- OrioleDB with cloud-native storage enginepolardb.md- Alibaba PolarDB for PostgreSQLpolardb-o.md- PolarDB with Oracle compatibilitypgml.md- PostgresML for machine learning workloadssupabase.md- Supabase PostgreSQL configurationgreenplum.md- Greenplum massively parallel processing databasecloudberry.md- Cloudberry Database (Greenplum fork)neon.md- Neon serverless PostgreSQL
Additional detailed documentation on specific topics.
user.md- In-depth user and role management guidedb.md- Comprehensive database management documentationacl.md- Detailed access control list configurationhba.md- Complete HBA rule syntax and examplessvc.md- Service configuration and load balancing details
playbook.md- PGSQL module playbook referencemetric.md- PostgreSQL metrics and monitoring indicatorsfaq.md- Frequently asked questions and troubleshooting
Infrastructure module providing DNS, NTP, Nginx reverse proxy, package repository, and the complete observability stack (VictoriaMetrics, Grafana, AlertManager).
admin/- Infrastructure administration (certificates, Grafana, Nginx, package repo management)config.md- INFRA module configuration optionsparam.md- Complete parameter reference for infrastructure componentsplaybook.md- Infrastructure playbooks for deployment and maintenancemonitor.md- Monitoring stack configuration and dashboard accessfaq.md- Common infrastructure issues and solutions
Node provisioning module for host configuration, VIP management, HAProxy load balancing, and node_exporter metrics collection.
admin.md- Node administration including adding, removing, and reconfiguring hostsconfig.md- Node configuration options and tuning parametersparam.md- Complete node parameter referenceplaybook.md- Node provisioning playbooksmonitor.md- Node monitoring and alerting configurationmetric.md- Node metrics collected by node_exporter
Distributed consensus store module. ETCD serves as the Distributed Configuration Store (DCS) for Patroni, enabling PostgreSQL high availability with automatic failover.
admin.md- ETCD cluster administration including member management and maintenanceconfig.md- ETCD configuration options and cluster topologyparam.md- Complete ETCD parameter referenceplaybook.md- ETCD deployment and maintenance playbooksmonitor.md- ETCD monitoring and health checks
S3-compatible object storage module. MinIO serves as the backup repository for pgBackRest, enabling off-site backup storage and cross-cluster backup sharing.
admin.md- MinIO cluster administration and bucket managementconfig.md- MinIO configuration for single-node and multi-node deploymentsparam.md- Complete MinIO parameter referenceusage.md- Using MinIO with pgBackRest and other applicationsmonitor.md- MinIO monitoring and performance metricsfaq.md- Common MinIO issues and solutions
Redis caching module supporting standalone, master-slave replication, sentinel, and cluster deployment modes.
admin.md- Redis administration including cluster management and failoverconfig.md- Redis configuration for different deployment modesparam.md- Complete Redis parameter referencemonitor.md- Redis monitoring and performance metricsfaq.md- Common Redis issues and troubleshooting
FerretDB module providing MongoDB wire protocol compatibility layer on top of PostgreSQL. Allows MongoDB applications to use PostgreSQL as the backend.
admin.md- FerretDB administration and connection managementconfig.md- FerretDB configuration and PostgreSQL integration
Docker runtime module for deploying containerized applications alongside Pigsty infrastructure.
usage.md- Docker usage guide and container managementplaybook.md- Docker deployment playbooksparam.md- Docker module parametersfaq.md- Common Docker issues and solutions
PIG package manager for PostgreSQL extensions. Command-line tool for discovering, installing, and managing the 451+ extensions available in the Pigsty ecosystem.
Software repository documentation covering the package infrastructure that delivers PostgreSQL, extensions, and system packages.
pgsql/- PostgreSQL package repository (deb.md for Debian/Ubuntu, rpm.md for RHEL/Rocky)infra/- Infrastructure package repositorygpg.md- GPG key management for package signing and verification
Additional experimental and internal modules not recommended for production use without thorough testing.
pilot/- Experimental module integrations (Kafka, MySQL, DuckDB, Kubernetes, Consul, etc.)pg_exporter/- Standalone PostgreSQL metrics exporter for external PostgreSQL instancespiglet/- Lightweight Pigsty variant for minimal deploymentsjuice/,vibe/- Internal development modules