基本上,我试图连接到托管在GCP虚拟机上的postgresql服务器。我已经在那里创建了数据库,我已经更改了我的防火墙以允许端口5432上的连接,将此--〉“listen_addresses = '*'“添加到我的postgresql.config文件,并使用trust方法将我的本地计算机的外部IP地址添加到pg_hba.conf文件上的可接受IP列表中。有没有人知道这里可能出了什么问题?我只是一直得到这个错误
postgres@LAPTOP-14QDEC1P:/mnt/d/random path $ psql -U postgres -p 5432 -h xx.xxx.xxx.xxx api_fp
psql: error: could not connect to server: Connection refused
Is the server running on host "xx.xxx.xxx.xxx" and accepting
TCP/IP connections on port 5432?
监听的端口也被设置为5432。
1条答案
按热度按时间ajsxfq5m1#
您还必须在VPC上允许Google Cloud Firewall规则才能使其工作。您可以从项目中的控制台打开Google Cloud Shell,并运行以下gcloud命令,以允许vpc网络中所有示例的防火墙规则:
有关此方面的文档,您可以阅读:https://cloud.google.com/vpc/docs/firewalls