Pgpool-II's Clustering Modes


Pgpool-II has been released for more than 15 years. When the version 1.0 was released, Pgpool-II had only replication mode. With the increase of new features (e.g. automatic failover, support for logical replication, etc.), the parameters for configuring cluster mode have increased. 

Clustering mode

Pgpool-II has six clustering modes available: 

It is important to specify the correct clustering mode to make Pgpool-II work as expected, because the clustering mode is used to determine how the data is replicated. Since Pgpool-II 4.2, the multiple parameters for configuring cluster mode have been merged into a single parameter backend_clustering_mode.

clustering mode Pgpool-II 4.1 or previous Pgpool-II 4.2 or later
master_slave_mode master_slave_sub_mode replication_mode backend_clustering_mode
Streaming replication mode on stream off streaming_replication
Logical replication mode on logical off logical_replication
Slony mode on slony off slony
Native replication mode off - on native_replication
Raw mode off - off raw
Snapshot isolation mode - - - snapshot_isolation

 

In the next sections, I will describe how the data is replicated in each clustering mode.

Streaming replication mode

This mode is most commonly used and recommended clustering mode. In this mode, PostgreSQL is responsible for replicating data.

To enable this mode:

backend_clustering_mode = 'streaming_replication'

Native replication mode

In this mode, Pgpool-II is responsible for replicating data. Pgpool-II replicates the same queries to each PostgreSQL server for database synchronization.

To enable this mode:

backend_clustering_mode = 'native_replication'

Snapshot isolation mode

Snapshot isolation mode which adds the visibility consistency among PostgreSQL servers is an extension of the native replication mode.

To enable this mode:

backend_clustering_mode = 'snapshot_isolation'

Logical replication mode

In logical replication mode, Pgpool-II manages PostgreSQL servers setup with logical replication. In this mode, PostgreSQL is responsible for replicating data objects between PostgreSQL servers.

To enable this mode:

backend_clustering_mode = 'logical_replication'

Slony mode

Pgpool-II supports for Slony-I. If you are using Slony-I to synchronize data between PostgreSQL servers, you need to enable this mode. In this mode, Slony-I is responsible for replicating data.

To enable this mode:

backend_clustering_mode = 'slony' 

Raw mode

In this mode, Pgpool-II is not responsible for data replication. This mode is only used for the purposes, such as limiting excess connections to PostgreSQL servers or enabling failover with multiple PostgreSQL servers.

backend_clustering_mode = 'raw'

Supported features in each clustering mode

Pgpool-II is a feature-rich middleware that supports the following features:

  • Load balancing
  • Connection pooling
  • Automatic failover
  • Replication
  • Online recovery
  • In memory query cache

Because the documentation doesn't mention the available features in each clustering mode, let me summarize here.

The table below shows which features are available in each mode.


Streaming replication mode Native replication mode Snapshot isolation mode Logical replication mode Slony mode Raw mode
Load balancing -
Connection pooling
Automatic failover
Replication - - - -
Online recovery - - -
In memory query cache

Comments

Popular posts from this blog

Query Load Balancing in Pgpool-II

Connection Pooling in Pgpool-II

Monitoring PostgreSQL Cluster via Pgpool-II with Prometheus