PIGSTY

Architecture

Node types, architecture, and core concepts

A "node" refers to a resource that is SSH accessible and offers a bare Linux OS environment. It could be a physical machine, a virtual machine, or an OS-like container equipped with systemd, sudo and sshd.

There are three different types of nodes in Pigsty, In a one-node deployment, they are the same one.

Node TypeDescription
Admin nodeThe node where Pigsty is installed and admin commands are issued
Infra nodeThe node where the INFRA module is installed
Common nodeAny nodes managed by Pigsty, including admin & infra nodes

Example

In the following 4-node sandbox config snippet, we have 4 common nodes.
And the 10.10.10.10 is marked as Infra Node and Admin Node simultaneously.

all:
  children:
    infra:   { hosts: { 10.10.10.10: { infra_seq: 1 } } }  # <--- mark this as infra node
    etcd:    { hosts: { 10.10.10.10: { etcd_seq: 1 } }, vars: { etcd_cluster: etcd } }
    pg-meta: { hosts: { 10.10.10.10: { pg_seq: 1, pg_role: primary } }, vars: { pg_cluster: pg-meta } }
    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 }
  vars:
    admin_ip: 10.10.10.10    # <--- mark this as admin node

Common Node

Common nodes have the following components enabled by default in Pigsty:

ComponentPortDescriptionDefault
node_exporter9100Node Monitoring Metrics ExporterEnabled
haproxy9101HAProxy admin / metrics portEnabled
promtail9080Log collecting agentEnabled

These components are optional, can be enabled with parameters.

ComponentPortDescriptionDefault
docker9323Enable Container ServiceDisabled
keepalivedN/AManage Node Cluster L2 VIPDisabled
keepalived_exporter9650Monitoring Keepalived StatusDisabled

ADMIN Node

Admin Node is the first node where Pigsty is installed, all control commands are issued from it.

There is one and only one admin node in a pigsty deployment, which is specified by admin_ip. This parameter will be set during the configure procedure, to the value of primary IP address.

Secure admin node access

The admin node should have nopass ssh and sudo access to all other nodes in the environment, which is dangerous when exposed to unauthorized access. Please keep it safe.

Admin node is the first node where Pigsty is installed

The admin node is the first node where Pigsty is installed, and it is used to issue commands to other nodes.
The admin node is usually overlapped with the infra node, same as the first infra node

It is possible to use your local laptop as admin node

It is possible to install pigsty on your local laptop / macbook, install ansible and issue commands from there.


INFRA Node

A pigsty deployment may have one or more infra nodes, at least 1, 2 or more for production deployment.

The infra group specifies infra nodes in the inventory. And infra nodes will have INFRA module installed (DNS, Nginx, Prometheus, Grafana, etc…).

ComponentPortDomainDescription
nginx80h.pigstyWeb Service Portal (YUM/APT Repo)
alertmanager9093a.pigstyAlert Aggregation and delivery
prometheus9090p.pigstyMonitoring Time Series Database
grafana3000g.pigstyVisualization Platform
lok3100-Logging Collection Server
pushgateway9091-Collect One-Time Job Metrics
blackbox_exporter9115-Blackbox Probing
dnsmasq53-DNS Server
chronyd123-NTP Time Server
ansible--Run playbooks

PGSQL Node

The node with PGSQL module installed is called a PGSQL node. The node and PG instance are 1:1 deployed. And node identities can be borrowed from pg instances with node_id_from_pg option.

Here are additional components & service port on PGSQL nodes:

ComponentPortDescriptionStatus
postgres5432PostgreSQL Server Process Managed by PatroniEnabled
pgbouncer6432Pgbouncer Connection PoolEnabled
patroni8008Patroni HA Component, Manage postgresEnabled
primary @ haproxy5433Primary connection pool: Read/Write ServiceEnabled
replica @ haproxy5434Replica connection pool: Read-only ServiceEnabled
default @ haproxy5436Primary Direct Connect ServiceEnabled
offline @ haproxy5438Offline Direct Connect: Offline Read ServiceEnabled
pg_exporter9630postgres Monitoring Metrics ExporterEnabled
pgbouncer_exporter9631pgbouncer Monitoring Metrics ExporterEnabled
pgbackrest_exporter9854pgbackrest Monitoring Metrics ExporterEnabled
vip-manager-Bind VIP to the primaryDisabled