google-templatespostgresql

Understand the default cluster configuration

The Bitnami Multi-Tier Solution for PostgreSQL uses multiple VMs, consisting of 1 master and 1 or more slaves, to provide a horizontally scalable and fault-tolerant deployment. Data automatically replicates from the master node to all slave nodes. PostgreSQL server is configured to listen for connections from any IP address (0.0.0.0).

To understand how it works, consider the example below of a two-node cluster (one master and one slave):

  • On the master node, create a new table and populate it with some data:

    postgres=# \c bitnami
    You are now connected to database "bitnami" as user "postgres".
    
    bitnami=# CREATE TABLE test (id INT NOT NULL, value VARCHAR(255) NOT NULL);
    CREATE TABLE
    
    bitnami=# INSERT INTO test VALUES (1, 'foo'), (2, 'bar');
    INSERT 0 2
    
  • On any of the slave nodes, check if the table exists and list its contents. It should display the same data originally entered on the master node:

    postgres=# \c bitnami
    You are now connected to database "bitnami" as user "postgres".
    
    bitnami=# select * from test;
     id | value
    ----+-------
      1 | foo
      2 | bar
    (2 rows)
    

This shows that records added on the master node are automatically replicated to the slave node(s). For more information, refer to the PostgreSQL documentation on replication.

Last modification September 5, 2018