1

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).

  1. 192.168.0.109 = master
  2. 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.

migrated from stackoverflow.com Feb 10 '14 at 0:49

This question came from our site for professional and enthusiast programmers.

2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.