I have a Python / Django application that will require balancing database loading at some point in the near future. In the meantime, I'm trying to learn how to implement pgpool in the local setup of a virtual machine.
I have 4 Ubuntu 12.04 VMs:
192.168.1.80 <- pool, pgppool2 installed and accessible 192.168.1.81 <- db1 master 192.168.1.82 <- db2 slave 192.168.1.83 <- db3 slave
I have pgpool-II version 3.1.1 and my database servers are running PostgreSQL 9.1.
I have an app db application pointed to 192.168.1.80:9999 and it works fine.
The problem is that I use Apache ab to load some load, none of the SELECT queries look balanced. All downloads go to my db1 master. In addition, the load on the pool server is quite relevant, it is really high compared to db1, maybe an average of 8-10 times higher. Meanwhile, my db2 and db3 servers have a load almost equal to zero, they, apparently, are replicated only from db1, which is not very intense for my tests with ab.
ab -n 300 -c 4 -C 'sessionid=80a5fd3b6bb59051515e734326735f80' http:
This loads the load on my pool server until about 2.3. Upload to db1 is about 0.4, and the load on db2 and db3 is almost zero.
Can someone take a look at my configuration and see what I am doing wrong?
backend_hostname0 = '192.168.1.81' backend_port0 = 5432 backend_weight0 = 1 backend_data_directory0 = '/var/lib/postgresql/9.1/main' backend_flag0 = 'ALLOW_TO_FAILOVER' backend_hostname1 = '192.168.1.82' backend_port1 = 5433 backend_weight1 = 1 backend_data_directory1 = '/var/lib/postgresql/9.1/main' backend_flag1 = 'ALLOW_TO_FAILOVER' backend_hostname2 = '192.168.1.83' backend_port2 = 5434 backend_weight2 = 1 backend_data_directory2 = '/var/lib/postgresql/9.1/main' backend_flag2 = 'ALLOW_TO_FAILOVER' load_balance_mode = on
All my configuration is here:
http: