google cloud platform - AlloyDB Proxy connecting to incorrect port - Stack Overflow

admin2025-04-19  0

Until recently I've been using the AlloyDB proxy as described in the documentation to connect to my AlloyDB instance using DBeaver from my local machine with no issues.

A few days ago however I started to get a "The connection attempt failed" message in DBeaver. Looking at the proxy logs I see the following:

name@mac alloydb_auth_proxy % ./alloydb-auth-proxy projects/<project-id>/locations/<location>/clusters/<cluster-name>/instances/<instance> --public-ip
2025/03/05 16:50:14 Authorizing with Application Default Credentials
2025/03/05 16:50:14 [<project>.<cluster-name>.<instance>] Listening on 127.0.0.1:5432
2025/03/05 16:50:14 The proxy has started successfully and is ready for new connections!
2025/03/05 16:52:14 [<project>.<cluster-name>.<instance>] accepted connection from 127.0.0.1:49738
2025/03/05 16:52:44 [<project>.<cluster-name>.<instance>] failed to connect to instance: Dial error: failed to dial (instance URI = "<project>/<location>/<cluster-name>/<instance>"): dial tcp <instance public IP>:5433: i/o timeout

The public IP is correct, but for some reason it seems to be trying to connect to the 5433 port when it should be using 5432. I've confirmed the DB connection information is correct as I can connect from a deployed container. I've tried reinstalling the proxy, re-authenticating, and restarting with no success.

Any help would be appreciated.

In case it's relevant I'm on a Mac running Sequoia 15.3.1.

Until recently I've been using the AlloyDB proxy as described in the documentation to connect to my AlloyDB instance using DBeaver from my local machine with no issues.

A few days ago however I started to get a "The connection attempt failed" message in DBeaver. Looking at the proxy logs I see the following:

name@mac alloydb_auth_proxy % ./alloydb-auth-proxy projects/<project-id>/locations/<location>/clusters/<cluster-name>/instances/<instance> --public-ip
2025/03/05 16:50:14 Authorizing with Application Default Credentials
2025/03/05 16:50:14 [<project>.<cluster-name>.<instance>] Listening on 127.0.0.1:5432
2025/03/05 16:50:14 The proxy has started successfully and is ready for new connections!
2025/03/05 16:52:14 [<project>.<cluster-name>.<instance>] accepted connection from 127.0.0.1:49738
2025/03/05 16:52:44 [<project>.<cluster-name>.<instance>] failed to connect to instance: Dial error: failed to dial (instance URI = "<project>/<location>/<cluster-name>/<instance>"): dial tcp <instance public IP>:5433: i/o timeout

The public IP is correct, but for some reason it seems to be trying to connect to the 5433 port when it should be using 5432. I've confirmed the DB connection information is correct as I can connect from a deployed container. I've tried reinstalling the proxy, re-authenticating, and restarting with no success.

Any help would be appreciated.

In case it's relevant I'm on a Mac running Sequoia 15.3.1.

Share Improve this question asked Mar 5 at 16:01 Jesus Diaz RiveroJesus Diaz Rivero 3372 silver badges8 bronze badges 1
  • That's expected. The proxy won't connect to the port for the DB but for a dedicated port used by the proxy. That's well documented cloud.google/alloydb/docs/auth-proxy/overview#how-works . So the issue seems more like a network problem on your side (maybe a firewall?) – Puteri Commented Mar 5 at 16:17
Add a comment  | 

1 Answer 1

Reset to default 1

I agree with Puteri. As also stated here in this documentation that’s expected.

AlloyDB instances accept connections on two TCP ports:

  • Port 5432, the default PostgreSQL port that applications use to connect directly to the instance.

  • Port 5433, which connectors, including AlloyDB Auth Proxy use to connect to the instance.

If you have an outbound firewall policy, make sure it allows connections to port 5433 on the target AlloyDB instance.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1745021961a280432.html

最新回复(0)