Install Pigsty for Production
This is the Pigsty production multi-node deployment guide. For single-node Demo/Dev setups, see Getting Started.
Summary
Prepare nodes with SSH access following your architecture plan,
install a compatible Linux OS, then execute with an admin user having passwordless ssh and sudo:
This runs the install script, downloading and extracting Pigsty source to your home directory with dependencies installed. Complete configuration and deployment to finish.
Before running deploy.yml for deployment, review and edit the configuration inventory: pigsty.yml.
After installation, access the WebUI via IP/domain + ports 80/443,
and PostgreSQL service via port 5432.
Full installation takes 3-10 minutes depending on specs/network. Offline installation significantly speeds this up; slim installation further accelerates when monitoring isn’t needed.
Video Example: 20-node Production Simulation (Ubuntu 24.04 x86_64)
Prepare
Production Pigsty deployment involves preparation work. Here’s the complete checklist:
| Item | Requirement | Item | Requirement |
|---|---|---|---|
| Node | At least 1C2G, no upper limit |
Plan | Multiple homogeneous nodes: 2/3/4 or more |
| Disk | /data as default mount point |
FS | xfs recommended; ext4/zfs as needed |
| VIP | L2 VIP, optional (unavailable in cloud) | Network | Static IPv4, single-node can use 127.0.0.1 |
| CA | Self-signed CA or specify existing certs | Domain | Local/public domain, optional, default i.pigsty |
| Kernel | Linux x86_64 / aarch64 |
Linux | el8, el9, el10, d12, d13, u22, u24, u26 |
| Locale | C.UTF-8 or C |
Firewall | Ports: 80/443/22/5432 (optional) |
| User | Avoid root and postgres |
Sudo | sudo privilege, preferably with nopass |
| SSH | Passwordless SSH via public key | Accessible | ssh <ip|alias> sudo ls no error |
Install
Use the following to automatically install the Pigsty source package to ~/pigsty (recommended). Deployment dependencies (Ansible) are auto-installed.
If you prefer not to run remote scripts, manually download or clone the source. When using git, always checkout a specific version before use:
For manual download/clone, additionally run bootstrap to manually install Ansible and other dependencies, or install them yourself:
Configure
In Pigsty, deployment details are defined by the configuration inventory—the pigsty.yml config file. Customize through declarative configuration.
Pigsty provides configure as an optional configuration wizard,
generating a configuration inventory with good defaults based on your environment:
The generated config defaults to ~/pigsty/pigsty.yml. Review and customize before installation.
Many configuration templates are available for reference. You can skip the wizard and directly edit pigsty.yml:
Example configure output
The wizard only replaces the current node’s IP (use -s to skip replacement). For multi-node deployments, replace other node IPs manually.
Also customize the config as needed—modify default passwords, add nodes, etc.
Common configure parameters:
| Parameter | Description |
|---|---|
-c|--conf |
Specify config template relative to conf/, without .yml suffix |
-v|--version |
PostgreSQL major version 14 through 19; PG19 is currently Beta |
-r|--region |
Upstream repo region for faster downloads: default|china|europe |
-n|--non-interactive |
Use CLI params for primary IP, skip interactive wizard |
-x|--proxy |
Configure proxy_env from current environment variables |
If your machine has multiple IPs, explicitly specify one with -i|--ip <ipaddr> or provide it interactively.
The script replaces IP placeholder 10.10.10.10 with the current node’s primary IPv4. Use a static IP; never use public IPs.
Generated config is at ~/pigsty/pigsty.yml. Review and modify before installation.
Change default passwords and credentials before installation. See Security Recommendations.
Deploy
Pigsty’s deploy.yml playbook applies the configuration blueprint to all target nodes.
Example deployment output
When output ends with pgsql init done, PLAY RECAP, etc., installation is complete!
Upstream repos (Linux/PGDG) may break due to improper updates, causing deployment failures (quite common)! For serious production deployments, we strongly recommend using verified offline packages for offline installation.
Warning: Running deploy.yml again on an initialized environment may restart services and overwrite configs. Be careful!
Interface
Assuming the 4-node deployment template, your Pigsty environment should have a structure like:
| ID | NODE | PGSQL | INFRA | ETCD |
|---|---|---|---|---|
| 1 | 10.10.10.10 |
pg-meta-1 |
infra-1 |
etcd-1 |
| 2 | 10.10.10.11 |
pg-test-1 |
- | - |
| 3 | 10.10.10.12 |
pg-test-2 |
- | - |
| 4 | 10.10.10.13 |
pg-test-3 |
- | - |
The INFRA module provides a graphical management interface via browser, accessible through Nginx’s 80/443 ports.
The PGSQL module provides a PostgreSQL database server on port 5432, also accessible via Pgbouncer/HAProxy proxies.
For production multi-node HA PostgreSQL clusters, use service access for automatic traffic routing.
More
After installation, explore the WebUI and access PostgreSQL service via port 5432.
Deploy and monitor more clusters—add definitions to the configuration inventory and run:
Most modules require the NODE module first. See available modules:
PGSQL, INFRA, NODE, ETCD,
MINIO, REDIS, DOCKER…
