# Pigsty v1.5.1 Documentation

> Historical documentation frozen at Pigsty v1.5.1.
---

## Pigsty v1.5.1 Documentation

**Battery-Included Open-Source PostgreSQL Distribution**

> Latest Version: [v1.5.1](https://github.com/Vonng/pigsty/releases/tag/v1.5.1)  |  [Github Repo](https://github.com/Vonng/pigsty) | [Demo](http://demo.pigsty.cc)
>
> Documentation: [EN Docs](https://pigsty.cc/) | [中文文档](https://pigsty.cc/#/zh-cn/) | [Github Pages](https://vonng.github.io/pigsty/#/)



## What is Pigsty?

[![](/img/history/v1.5/WHAT_EN.svg)](/docs/s-feature/)

**Pigsty** is battery-included open-source database [distribution](/docs/s-feature/#postgresql-distribution), with the latest [PostgreSQL](https://www.postgresql.org/) kernel, [TimescaleDB](https://www.timescale.com), [PostGIS](https://postgis.net/), [Citus](https://www.citusdata.com/) & 100+ extensions, along with an entire [Infra](/docs/c-infra/): Grafana, Prometheus, Loki, Ansible, [Docker](/docs/t-docker/) to support your databases & [applications](/docs/s-feature/#versatile-scenario). It also includes common tools for [data analysis](/docs/s-feature/#data-analysis).

Pigsty is a [monitoring](/docs/s-feature/#ultimate-observability) & management [SRE Solution](/docs/s-feature/#sre-solution). Which includes an unparalleled [monitoring](/docs/s-feature/#open-source-rds) system with ultimate observability, and [high-available](/docs/c-pgsql/#high-availability) PostgreSQL with self-healing architecture. You can deploy various clusters & instances: [primary, replica](/docs/d-pgsql/#m-s-replication), [standby](/docs/d-pgsql/#sync-standby), [offline](/docs/d-pgsql/#offline-replica), [delayed](/docs/d-pgsql/#delayed-cluster), [cascade](/docs/d-pgsql/#cascade-instance), and even [Citus](/docs/d-pgsql/#citus-deployment), [Redis](/docs/d-redis/), and [Greenplum](/docs/d-matrixdb/) clusters.

Pigsty is a handy [toolbox](/docs/s-feature/#developer-toolbox) for developers. It treats [**Database as Code**](/docs/s-feature/#database-as-code), Infra as Data. You just [describe](/docs/v-config/) what database you want, and pigsty will create it for you. You can download, install, deploy, scale, backup, migration with [one command](/docs/s-install/).  It can be deployed [everywhere](/docs/s-feature/#ubiquitous-deployment): a 10k+ core prod env or local 1C/2G VM, [cloud](/docs/d-sandbox/#cloud-sandbox), or [on-premises](/docs/d-sandbox/#local-sandbox).

Pigsty is a [secure](/docs/s-feature/#safty) & [thrifty](/docs/s-feature/#safty) alternative to [Cloud RDS](/docs/s-feature/#open-source-rds)/PaaS. It can empower a single DEV/DBA to manage hundreds of databases clusters, with all data under your own control. It can [save](/docs/s-feature/#safty) 50% - 80% cost compared to cloud RDS using ECS or on-premise deployment. And the software itself is completely [open-source](https://github.com/Vonng/Capslock/blob/master/LICENSE) & free!

Check [FEATURES](/docs/s-feature/) for more detail.


<details><summary>Distribution</summary>

[![Distribution](/img/history/v1.5/DISTRIBUTION.gif)](/docs/c-infra/#overview)

</details>

<details><summary>Observability</summary>

[![Observability](/img/history/v1.5/overview-monitor.jpg)](http://demo.pigsty.cc)

</details>

<details><summary>High Availability</summary>

[![High Availability](/img/history/v1.5/HA-PGSQL.svg)](/docs/c-pgsql/#high-availability)

</details>

<details><summary>Architecture</summary>

[![Architecture](/img/history/v1.5/ARCH.gif)](/docs/c-arch/)

</details>

<details><summary>Sandbox</summary>

[![Sandbox](/img/history/v1.5/SANDBOX.gif)](/docs/d-sandbox/)

</details>

<details><summary>Provisioning</summary>

[![Provisioning](/img/history/v1.5/PROVISION.gif)](/docs/d-deploy/)

</details>

<details><summary>User Interface</summary>

[![User Interface](/img/history/v1.5/interface.jpg)](/docs/s-install/)

</details>

<details><summary>Application</summary>

[![Application](/img/history/v1.5/overview-covid.jpg)](/docs/t-application/)

</details>



## TL; DR

Get a new Linux x86_64 CentOS 7.8 node. with nopass `sudo` & `ssh` access, then:

```bash
curl -SL https://github.com/Vonng/pigsty/releases/download/v1.5.1/pigsty.tgz | gzip -d | tar -xC ~  # get latest pigsty source
cd ~/pigsty && ./configure                             # pre-check and config templating
./infra.yml                                            # install pigsty on current node
```

Now you have a battery-included Postgres on port **5432** and infra web services available on port **80**.

Check [Installation](/docs/s-install/) & [Demo](http://demo.pigsty.cc) for details.

![](/img/history/v1.5/HOW_EN.svg)



<details><summary>Download Packages Directly</summary>

Pigsty source & software packages can be downloaded directly via `curl` in case of no Internet connection:

```bash
curl -SL https://github.com/Vonng/pigsty/releases/download/v1.5.1/pkg.tgz -o /tmp/pkg.tgz
curl -SL https://github.com/Vonng/pigsty/releases/download/v1.5.1/pigsty.tgz | gzip -d | tar -xC ~
```

</details>


<details><summary>Mange More Nodes</summary>

You can add more nodes to Pigsty with [`nodes.yml`](/docs/p-nodes/#nodes) after installing the meta node with [`infra.yml`](/docs/p-infra/#infra).

```bash
./nodes.yml  -l pg-test      # init 3 nodes of cluster pg-test
```

</details>

<details><summary>Define Postgres Cluster</summary>

You can define a HA Postgres Cluster with streaming replication in a few lines of code:

```yaml
pg-test:
  hosts:
    10.10.10.11: {pg_seq: 1, pg_role: primary}
    10.10.10.12: {pg_seq: 2, pg_role: replica}
    10.10.10.13: {pg_seq: 3, pg_role: replica}
  vars:
    pg_cluster: pg-test
```

You can create Postgres with different [roles](/docs/d-pgsql/) by declaring them: primary, replica, standby, delayed, offline, cascade, etc...

</details>


<details><summary>Deploy Databases Clusters</summary>

You can deploy different types of databases & clusters with corresponding playbooks.

* [`pgsql.yml`](/docs/p-pgsql/#pgsql): Deploy HA PostgreSQL clusters.
* [`redis.yml`](/docs/p-redis/#redis): Deploy Redis clusters.
* [`pgsql-matrixdb.yml`](/docs/p-pgsql/#pgsql-matrixdb): Deploy matrixdb data warehouse (greenplum7).

```bash
./pgsql.yml         -l pg-test      # init 1-primary & 2-replica pgsql cluster
./redis.yml         -l redis-test   # init redis cluster redis-test
./pgsql-matrixdb.yml -l mx-*         # init MatrixDB cluster mx-mdw,mx-sdw .....
```

</details>




## About

> Pigsty (/ˈpɪɡˌstaɪ/) is the abbreviation of "PostgreSQL In Graphic STYle."

Author: [Vonng](https://vonng.com/en) ([rh@vonng.com](mailto:rh@vonng.com))

License: [Apache 2.0 License](https://github.com/Vonng/Capslock/blob/master/LICENSE)

Beian: [浙ICP备15016890-2号](https://beian.miit.gov.cn/)

---

Section pages:

- [Introduction](/docs/s-intro/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Installation](/docs/s-install/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Features](/docs/s-feature/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [FAQ: Frequently Asked Questions](/docs/s-faq/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Concepts](/docs/c-concept/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Architecture](/docs/c-arch/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Infrastructure](/docs/c-infra/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Concept: Nodes](/docs/c-nodes/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Concept: PGSQL](/docs/c-pgsql/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Concept: Redis](/docs/c-redis/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [PGSQL Service & Access](/docs/c-service/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [PGSQL Authentication and Privilege](/docs/c-pgdbuser/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [PGSQL Authentication and Privilege](/docs/c-privilege/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Pigsty Deployment](/docs/d-deploy/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Preparation](/docs/d-prepare/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Sandbox](/docs/d-sandbox/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Monitoring System](/docs/d-monly/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [PostgreSQL Deployment](/docs/d-pgsql/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Redis Deployment](/docs/d-redis/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [MatrixDB Deployment](/docs/d-matrixdb/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Playbooks](/docs/p-playbook/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Playbook: INFRA](/docs/p-infra/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Playbook: NODES](/docs/p-nodes/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Playbook: PGSQL](/docs/p-pgsql/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Playbook: REDIS](/docs/p-redis/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Configuration](/docs/v-config/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Config: Infra](/docs/v-infra/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Config: Nodes](/docs/v-nodes/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Config: PGSQL](/docs/v-pgsql/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Config: REDIS](/docs/v-redis/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Customize: PGSQL](/docs/v-pgsql-customize/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Pigsty Dashboards](/docs/m-dashboard/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Service Discovery](/docs/m-discovery/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Metrics](/docs/m-metric/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Alerting](/docs/r-alert/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Install Applications](/docs/t-application/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Docker Applications](/docs/t-docker/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Upgrade Grafana Backend Database](/docs/t-grafana-upgrade/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Jupyter Lab](/docs/t-jupyter/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Backup and Recovery](/docs/t-backup/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Offline Installation](/docs/t-offline/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [CMDB Usage](/docs/t-cmdb/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Migration Tutorial](/docs/t-migration/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [PGSQL SOP: Standard Operating Procedure](/docs/r-sop/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [FHS: File Hierarchy Structure](/docs/r-fhs/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [HA Scenarios](/docs/r-ha/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Common Failures](/docs/r-failure/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Community](/docs/community/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Roadmap](/docs/roadmap/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Development Log](/docs/devlog/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Why Pigsty](/docs/s-value/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [User Interface](/docs/s-interface/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Deploy](/docs/t-deploy/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Customization of Postgres Template](/docs/t-pgsql-customize/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Redis Deploy & Monitor](/docs/t-redis/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [PGWeb](/docs/t-pgweb/): Historical documentation restored from the Pigsty v1.5.1 tag.
- [Using TimescaleDB to store Prometheus data](/docs/t-promscale/): Historical documentation restored from the Pigsty v1.5.1 tag.
