Configs2026年9月12日·1 分钟阅读

Pigsty — PostgreSQL Distribution with Batteries Included

An open-source PostgreSQL distribution that bundles HA clustering, monitoring, IaC provisioning, and 340+ extensions into a single deployment toolkit.

Agent 就绪

先审查再安装

这个资产需要先审查。复制的指令会要求 Agent dry-run、列出写入项,确认后再继续。

Needs Confirmation · 64/100策略:需确认
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
Pigsty
先审查命令
npx -y tokrepo@latest install 3fc4f194-aeaa-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run,确认写入项后再运行此命令。

Introduction

Pigsty is an open-source PostgreSQL distribution that packages high-availability clustering, monitoring dashboards, and hundreds of extensions into a single Ansible-driven deployment. It aims to give every PostgreSQL user a production-grade setup without manually stitching together separate tools for replication, backups, and observability.

What Pigsty Does

  • Deploys PostgreSQL clusters with automatic failover via Patroni and etcd
  • Provides pre-built Grafana dashboards for database, system, and query monitoring
  • Bundles 340+ PostgreSQL extensions including PostGIS, TimescaleDB, and pgvector
  • Manages infrastructure provisioning with Ansible playbooks and a declarative inventory
  • Includes local YUM/APT repos for air-gapped and offline installations

Architecture Overview

Pigsty uses Ansible to orchestrate multi-node PostgreSQL clusters. Each database node runs Patroni for leader election, pgBouncer for connection pooling, and a local monitoring agent. A dedicated infra node hosts Grafana, Prometheus, Alertmanager, and a local package repository. Configuration is defined in a single YAML inventory file, and playbooks handle the full lifecycle from bootstrap to scaling.

Self-Hosting & Configuration

  • Requires a Linux host (RHEL, Debian, or Ubuntu) with root or sudo access
  • Run the bootstrap script to install Ansible and prepare the local repo
  • Edit pigsty.yml to define cluster topology, replication mode, and resource limits
  • Deploy additional nodes by adding entries to the inventory and re-running the playbook
  • Supports Vagrant and Terraform templates for local and cloud sandbox environments

Key Features

  • One-command deployment of production-ready PostgreSQL with HA
  • Over 30 pre-built Grafana dashboards covering queries, locks, replication lag, and system metrics
  • Built-in DKIM/PITR backup via pgBackRest with S3 and local storage targets
  • Extension marketplace with pre-compiled packages for major PostgreSQL versions
  • Multi-cluster management from a single admin node

Comparison with Similar Tools

  • CloudNativePG — Kubernetes-native operator; Pigsty targets bare-metal and VM deployments
  • Crunchy PGO — Kubernetes PostgreSQL operator; Pigsty uses Ansible for non-K8s environments
  • Patroni (standalone) — HA only; Pigsty bundles monitoring, extensions, and provisioning
  • pgAdmin — GUI for a single server; Pigsty manages fleets with dashboards and automation
  • Percona Distribution for PostgreSQL — similar concept but Pigsty includes richer monitoring out of the box

FAQ

Q: Can Pigsty run on a single node for development? A: Yes. A single-node sandbox mode installs everything on one machine, which is useful for testing and development.

Q: Does Pigsty support major PostgreSQL version upgrades? A: It provides packages for multiple PostgreSQL versions and supports in-place minor upgrades. Major version upgrades can be done with pg_upgrade following the documented procedure.

Q: Is internet access required during installation? A: Not if you pre-download the offline package. Pigsty can bootstrap entirely from local repos, making it suitable for air-gapped environments.

Q: How does Pigsty handle backups? A: It integrates pgBackRest for full, incremental, and differential backups with point-in-time recovery, stored locally or on S3-compatible storage.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产