Repository navigation
Closed
Milestone
Description
Sub-issues:
- Implement load balancing for multiple hosts #3623
- Connection timeout with multiple hosts #3619
- Support async default_transaction_read_only and in_hot_standby for multiple hosts #3609
- Escape hatch API to manually control cluster state (for multiple hosts) #4018
Further improvements are tracked in #3613.
Resources:
- libpq support
- Brief PostgreSQL documentation on basic multiple hosts (no TargetServerType): https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-MULTIPLE-HOSTS
- Discussion in the pgsql-hackers list for adding this to libpq.
- https://www.postgresql.org/message-id/CADK3HHLo-jTh4S1PYd7Qx5t8hscH-6emBy9fWFv1dUwhPzyTzA%40mail.gmail.com
- Also see https://www.postgresql.org/message-id/20150818041850.GA5092%40wagner.pp.ru.
- Discussion: Libpq support to connect to standby server as priority
- https://www.cybertec-postgresql.com/en/new-target_session_attrs-settings-for-high-availability-and-scaling-in-postgresql-v14/
- http://paquier.xyz/postgresql-2/postgres-10-multi-host-connstr/
- http://paquier.xyz/postgresql-2/postgres-10-libpq-read-write/ (read-only/read-write support)
- JDBC documentation
- SqlClient database mirroring (Failover Partner) support. This is very partial compared to what pgjdbc or even libpq provide, but still.
Reacted by Evgeny Morozov, cocowalla, Aminoguana Kattunga and Arjun Vachhani
Activity
[-]Allow specifying multiple hosts/ports for connecting[/-][+]Failover connections[/+]roji commentedon Oct 11, 2016
Also support multi-master scenarios such as BDR?
day01 commentedon Oct 25, 2016
What do you think about prepare availability set provider for connection string?
One interface instead connection string. Lets developers decide which method should be used (failover, bdr)
roji commentedon Oct 25, 2016
@day01 I'm not clear on what you mean, can you elaborate and provide examples?
Regardless, this is probably not a feature that will make it into 3.2...
[-]Failover connections[/-][+]Multiple hosts in connection string[/+]roji commentedon Feb 14, 2017
PostgreSQL 10 includes this in libpq, JDBC driver already does this.
http://paquier.xyz/postgresql-2/postgres-10-multi-host-connstr/
http://paquier.xyz/postgresql-2/postgres-10-libpq-read-write/
FlorianRainer commentedon Mar 14, 2017
Copied from https://www.postgresql.org/docs/devel/static/libpq-connect.html#libpq-connstring
I think it must be something like a paralell
TryToConnectfor each host and the first successfully established connection will be used. A sequential check would wait to long if the host is not responding.roji commentedon Mar 14, 2017
I'll definitely be looking into this for 3.3.
roji commentedon Mar 14, 2017
@FlorianRainer one thing though... the documentation you quote is pretty clear about the attempts being sequential and not parallel as you suggest. The problem with doing things in parallel, is that you'd be constantly overloading all the servers with connection requests (which are a pretty heavy thing), while only one will actually be retained. You'd also be generating lots of bogus connection errors at the backends.
50 remaining items
mintsoft commentedon Mar 13, 2021
Awesome, thanks @vonzshik I'll take a look
Multiple hosts and target server type feature (#3607)
[-]Multiple hosts in connection string[/-][+]Multiple hosts, failover and load balancing[/+]A few fixes and additions for multiple hosts (#3628)
Document multiple hosts, failover and load balancing
Document multiple hosts, failover and load balancing
Document multiple hosts, failover and load balancing (#92)