PGSQL Basic
Basic primary-replica postgres cluster setup
Singleton
Let’s start with the simplest case.
pg-test:
hosts:
10.10.10.11: { pg_seq: 1, pg_role: primary }
vars:
pg_cluster: pg-test
Use the following command to create a primary database instance on the 10.10.10.11
node.
bin/createpg pg-test
M-S Replication
Pigsty natively supports M-S replication, e.g., to declare a typical one primary & one replica HA database cluster.
pg-test:
hosts:
10.10.10.11: { pg_seq: 1, pg_role: primary }
10.10.10.12: { pg_seq: 2, pg_role: replica }
vars:
pg_cluster: pg-test
Use bin/createpg pg-test
to create the cluster. If you have already finished deploying 10.10.10.11
in step 1 singleton deployment, you can also use bin/createpg 10.10.10.12
to expand the cluster.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.
Last modified 2022-06-04: fii en docs batch 2 (61bf601)