Database Creation

Once all the work is done, we can safely test our cluster. We will create a simple database with one table and query it from multiple hosts:

host1 Create empty database: test

host2 Create a table and insert value inside:

host3 Select the table:

Stop/Start the Cluster

Stopping or starting the cluster is very simple with only couple command words:

Start Cluster

Stop Cluster

Similar to the start command, the stopping of the cluster can also be done easily: There are 3 ways how we can stop the cluster:

SIGTERM

This is the Smart Shutdown mode. After receiving SIGTERM, the server disallows new connections, but lets existing sessions end their work normally. It shuts down only after all of the sessions terminate. If the server is in online backup mode, it additionally waits until online backup mode is no longer active. While backup mode is active, new connections will still be allowed, but only to superusers (this exception allows a superuser to connect to terminate online backup mode). If the server is in recovery when a smart shutdown is requested, recovery and streaming replication will be stopped only after all regular sessions have terminated.

SIGINT

This is the Fast Shutdown mode. The server disallows new connections and sends all existing server processes SIGTERM, which will cause them to abort their current transactions and exit promptly. It then waits for all server processes to exit and finally shuts down. If the server is in online backup mode, backup mode will be terminated, rendering the backup useless.

SIGQUIT

This is the Immediate Shutdown mode. The master postgres process will send a SIGQUIT to all child processes and exit immediately, without properly shutting itself down. The child processes likewise exit immediately upon receiving SIGQUIT. This will lead to recovery (by replaying the WAL log) upon next start-up. This is recommended only in emergencies.