node.js - Gcloud Postgres 不会与 App Engine 连接

标签 node.js postgresql google-app-engine google-cloud-platform

在这方面遇到了一些麻烦。目前正在试用 Google Cloud,但我的 GCloud Postgres 数据库无法链接到我的应用引擎应用。

我正在关注这里的一切:

https://cloud.google.com/appengine/docs/flexible/nodejs/using-cloud-sql-postgres

但是,当我尝试运行 createTables.js 进程时,出现以下问题:

Failed to create 'visits' table: { Error: connect ECONNREFUSED 127.0.0.1:5432
    at Object._errnoException (util.js:1026:11)
    at _exceptionWithHostPort (util.js:1049:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1174:14)
  code: 'ECONNREFUSED',
  errno: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 5432 }

数据库并不是我的强项,所以我有点难过。

它们都在同一个 GCloud 项目中运行。

如果您需要我提供更多信息,请告诉我(不确定到底有什么用)

干杯,

周杰伦

最佳答案

要在 Google Cloud Postgres 和 App Engine 之间建立连接,请尝试以下步骤:

  • 启用API

  • 在本地机器上安装代理客户端

  • 决定谁来验证代理

  • 创建一个服务帐户,以防您的身份验证方法需要它

  • 决定如何为代理指定实例

  • 启动代理

  • 更新您的应用并将其连接到 Googe Cloud Postgres

关于node.js - Gcloud Postgres 不会与 App Engine 连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48496999/

相关文章:

django - 将多个处理器与 django-nose 一起使用会产生 DatabaseError

ruby-on-rails - 使用 rails 查找空的 Postgres json 子数组

google-app-engine - 如何从 webapp2_extras.appengine.auth.models.Unique 中删除?

node.js - Node/ react 应用程序返回 "SyntaxError: Unexpected token import"错误

node.js - Express res header 事件不再触发

linux - 在 nodejs 的部署服务器上初始化 git

javascript - 使用指针查找 Mongoose 对象

postgresql - SQL查询以获取枚举可以具有的所有值

python - App Engine 模型,get_or_insert 问题 w.r.t 主键和复合键

flash - 谷歌应用引擎可以用作套接字服务器吗?