Thread: loadBalanceHosts and weighted server selection

loadBalanceHosts and weighted server selection

From
Michael Charnoky
Date:
Hi, we'd like to take advantage of the "loadBalanceHosts" feature of the jdbc driver. The only hitch is that we'd like to have the driver prefer one host over the other based on some sort of "weight". Ideally the driver would choose hostA 2/3 of the time and the hostB 1/3 of the time (all queries are read-only). Can we achieve this by specifying hostA twice in the jdbc url? For example, would this work?

jdbc:postgresql://hostA,hostA,hostB/dbname?loadBalanceHosts=true

Thanks,
noky