【问题标题】:Google Cloud Postgres Server Connection IssueGoogle Cloud Postgres 服务器连接问题
【发布时间】:2018-08-14 10:21:41
【问题描述】:

我收到"Could not obtain connection to query metadata : Cannot create Poolable ConnectionFactory (Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.)" 当我尝试通过我的代码连接到 Postgress 时,

我尝试通过这个命令通过 ssh 连接它正在连接

gcloud beta sql connect instance_name --user=USER

但是当我尝试通过普通 PSQL 命令连接时,它会给出连接超时。 Google Cloud SQL 连接突然停止,而它运行了 5 天以上。

我正在尝试连接为

<beans:bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
    destroy-method="close">
    <beans:property name="driverClassName" value="org.postgresql.Driver" />
    <beans:property name="url"
        value="jdbc:postgresql://databaseip:5432/db" />
    <beans:property name="username" value="user" />
    <beans:property name="password" value="password" />
</beans:bean>

请帮我把它正确连接,让我们知道是什么问题 我正在使用 PostgreSQL 9.6 和谷歌云 wildfly-10.1.0.Final 服务器,托管在谷歌云服务器的内部 ip 中

【问题讨论】:

    标签: postgresql google-cloud-platform google-cloud-datastore google-cloud-sql wildfly-10


    【解决方案1】:

    Cloud SQL 实例的最大连接数取决于实例层 limit。如果您的设置之前正常工作但突然停止,则您可能已达到此限制。您可以使用here 中描述的“连接池”方法来管理 SQL 实例中的大量连接。

    同样如公共documentation 中所述,请确保您已授权外部应用程序的 IP 地址,您尝试通过该地址访问 SQL 实例,并且您没有使用私有网络 IP。

    【讨论】:

      猜你喜欢
      • 2017-12-05
      • 2021-07-22
      • 2013-06-15
      • 2018-02-16
      • 2023-02-23
      • 2020-03-22
      • 2020-10-11
      • 1970-01-01
      • 2016-02-06
      相关资源
      最近更新 更多