I have already setup 2 ubuntu server 12.04 LTS on my local machine using virtual box and is using the master-slave replication (postgresql 9.1).
- 192.168.0.109 = master
- 192.168.0.110 = slave
my question is how to apply the load-balancing based on the two database server? I've heard about pgpool2 and pgbouncer, which one should I use?
Thanks guys and sorry I am new to postgres replication.
Best Answer
Of PgBouncer and PgPool-II, only PgPool-II supports load balancing.
PgPool-II's load balancing supports only read-only queries that meet certain requirements; see the pgpool docs. Additionally, if you start load-balancing queries you are no longer guaranteed to get a consistent view of the database because the replica might be lagging behind the master.
Personally, I'd look into adding a caching layer (memcached / Redis) before doing fiddly things like read-query load balancing.