Pull request for better handling of master/slave and load balancing when connecting to multiple hosts

Поиск
Список
Период
Сортировка
От Mikko Tiihonen
Тема Pull request for better handling of master/slave and load balancing when connecting to multiple hosts
Дата
Msg-id 1414802059544.34620@nitorcreations.com
обсуждение исходный текст
Список pgsql-jdbc

https://github.com/pgjdbc/pgjdbc/pull/209

It is a rewrite of the original request from 2011 by chenhj@cn.fujitsu.com.


If multiple hosts are specified in the jdbc connection url then:

  • Adds optional querying of node writability and possibility to restrict connections to writable or read-only nodes.
  • Adds optional load balancing of connections.
  • Uses a JVM global cache of known node states.

By default the functionality stays the same compared to previous versions.


To run the unit tests one needs to configure a replication slave and configure slaveServer and slavePort properties in addition to the normal server and port.


I have a few questions about how to best detect the master/slave node:

  1. Is the method show transaction_read_only = off still the best way on more modern postgresql to detect if we are connection to the master or slave?
  2. Are there some other settings/functions that should be invoked to get better information about nodes to choose. Like how far behind the replica is from the master. We might not want to use slaves if they are too much behind.

-Mikko

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Kevin Grittner
Дата:
Сообщение: Re: Hung thread
Следующее
От: Mikko Tiihonen
Дата:
Сообщение: Pipelining executions to postgresql server