Install Pigsty for Production
This guide describes production deployment on multiple nodes. For single-node demonstrations or development, use Getting Started.
Summary
- Prepare the nodes according to your architecture plan.
- Install a supported Linux operating system.
- Configure SSH access.
- Use an administration account with passwordless
sshandsudoaccess. - Run the installation command:
The installation script downloads and extracts Pigsty into your home directory. It also installs the dependencies. Then complete configuration and deployment.
Before you run deploy.yml, examine and edit pigsty.yml.
This file is the configuration inventory.
After deployment, open the Web UI through the IP address or domain on ports 80/443.
Connect to PostgreSQL on port 5432.
Installation usually takes 3-10 minutes, depending on server resources and network speed. Offline installation can reduce this time. If you do not need monitoring, Slim Installation installs fewer components and takes less time.
Example: 20-node production simulation on Ubuntu 24.04, x86_64
Prepare
Use this checklist to complete the deployment preparations:
| 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 one of these commands to install the Pigsty source package into ~/pigsty.
This method is recommended and also installs Ansible and other deployment dependencies.
You can instead download a release or clone the source repository.
If you use git, select a released version before deployment:
After a manual download or clone, run bootstrap to install Ansible and the other dependencies.
You can also install them yourself.
Configure
The inventory defines the deployment configuration.
Pigsty uses pigsty.yml as the default configuration file.
Edit it to define the required deployment.
The configure script is an optional configuration wizard.
It generates an inventory with defaults for your environment:
The default output file is ~/pigsty/pigsty.yml.
Examine this file and make the necessary changes before deployment.
Use the configuration templates as examples.
You can also edit pigsty.yml directly without the wizard:
Example configure output
The wizard replaces only the current node IP address.
Use -s to skip this replacement.
For multiple nodes, replace the other IP addresses manually.
Change default passwords, add nodes, and adjust other configuration values for your environment.
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 the node has multiple IP addresses, select its primary address with -i|--ip <ipaddr> or enter it interactively.
The script replaces 10.10.10.10 with the current node’s primary IPv4 address.
Use a static private address.
Do not use a public IP address.
Review the generated ~/pigsty/pigsty.yml before deployment.
Change default passwords and credentials before deployment. See Security Recommendations.
Deploy
The deploy.yml playbook applies the configuration to all target nodes:
Example deployment output
The final installation output includes pgsql init done and PLAY RECAP.
Incorrect updates to Linux or PGDG repositories can break dependencies and cause deployment failures. These failures are common. For production, we strongly recommend verified offline packages for offline installation.
Another run of deploy.yml on an existing deployment can restart services and overwrite configuration files.
Examine the required changes before you run it again.
Interface
The 4-node template creates this deployment structure:
| 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 supplies the Web UI through Nginx on ports 80/443.
The PGSQL module supplies a PostgreSQL server on port 5432.
You can also connect through PgBouncer or HAProxy.
For production HA clusters, use service access to route traffic automatically.
More
After installation, open the Web UI and connect to PostgreSQL on port 5432. To deploy and monitor additional clusters, add their definitions to the inventory. Then run the applicable commands:
Most modules require the NODE module first.
See the module reference.
Available modules include PGSQL, INFRA, NODE, ETCD, MINIO, REDIS, and DOCKER.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)
