0
votes

I know, that in case of synchronous streaming replication Slave server can accept read only queries (hot standby). My question: do I need to set-up JDBC connection directly to Slave, or Master will automatically forward read only request to Slave.

I do know that there is pg-pool-II that do load balancing. But what about simple situation when you have Master and Slave? Do you need only connection to Master and it will decide itself to run query himself or forward it to Slave, or you need directly to make connection to the Slave (by this, I mean using Slave's IP in JDBC).

I found nothing in docs. My feeling is that no, you need to specify directly in JDBC connection to Slave as Postgres is not a load balancer. But may be....

Thanks for answers.

1

1 Answers

1
votes

You connect as normal to the slave and issue your queries. There's no point in shipping queries and results twice (once to the master, on to the slave, back to the master then back to client).

Oh, you can have a "hot standby" server in synchronous/async and streaming/wal-shipping files. Obviously shipping wal files can mean the standby is some time behind the master server, but that doesn't always matter.