-
Notifications
You must be signed in to change notification settings - Fork 837
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Usage with RDS or other HA Solutions #299
Comments
What if we test the connections before saying they're available here: https://github.com/jackc/pgx/blob/master/conn_pool.go#L280 ? |
I'd like to support or at least provide hooks to support this use case. But what would the hook do? If Amazon has changed the IP the FQDN resolves to shouldn't creating a connection normally connect to the new server? Calling Regardless of that, the |
As far as |
Im currently also looking into failover scenarios. I see that the jdbc driver supports multiple hosts in the connection url: https://jdbc.postgresql.org/documentation/head/connect.html . Can also extend that for load balancing. |
@jackc libpq supports these scenarios now through https://paquier.xyz/postgresql-2/postgres-10-libpq-read-write/ It essentially just does a round-robin check for whether the connection is read-only (then rewrites the string so later connection attempts try in the last-known-good order). Is that something you think could get into the roadmap? Would be great to have built-in HA here. I might be able to sneak in a first pass at it during the holiday weekend |
I agree it would be good to have compatibility with libpq on this feature -- a PR would be welcomed. |
I believe this issue is resolved now that pgx has support for |
I don't think target_session_attrs fixes this with RDS domain name updates. RDS does not expose multiple hostnames, they rely upon the client re-resolving the DNS record when there is a connection failure. |
When one uses RDS they connect to a given fqdn(host) and port . In the event of a failover scenario, amazon changes the IP that the fqdn points to to a hot spare pg box.
I tested the failover and it seems that pgx did not detect anything occurred. Is it possible to have pgx testOnAcquire or similar? Basically I want some kind of hook where I can have the pool detect it's no longer working and make it connect to the new IP address.
Thoughts?
The text was updated successfully, but these errors were encountered: