#pgpool2

Replication and Load Balance in PosgreSQL 9.4 with PgPool2

When you design a scale, high availability, high performance system, I sure that you have to apply Replication, Sharding and Load Balance technologies for your database layer. In this post, I will show you the way how to setup a load balance with PgPool2 for your PostgreSQL Master-Slave Replication.

My scenario as image below:

pgpool (1)

Step 1: Install PostgreSQL Replication for your servers

At first, Please refer to 2 posts:

 

After that, install Pgpool Lib:

Step 2, Install PgPool2 for server 192.168.1.3

Edit /etc/pgpool2/pgpool.conf as below:

Make sure you set enable_pool_hba = on

And change /etc/pgpool2/pool_hba.conf to enable md5 for authentication:

Add account to /etc/pgpool2/pool_passwd.conf (just a example)

Now, run pgpool with log:

And stop Pgpool if you need:

Finally, test your installation. Good Luck!