无法连接到数据库-设置GCP应用引擎 [英] Failed to connect to Database - Setting up GCP app engine

查看:108
本文介绍了无法连接到数据库-设置GCP应用引擎的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的phoenix应用程序上设置一个实例.我实际上可以生成该应用程序,但是尝试连接到数据库时出现错误:

I'm trying to setup an instance on my phoenix app. I'm actually able to generate the app but I'm getting an error when trying to connect to the DB:

21:11:31.017 [error] Postgrex.Protocol (#PID<0.2223.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (/tmp/cloudsql/statcasters:us-central1:statcastersdb): no such file or directory - :enoent

我不确定出什么问题了吗?该文件似乎存在,但似乎不存在:

I'm not sure what is wrong? The file seems to exist but it seems to say it doesn't:

config :statcasters, Statcasters.Repo,
  username: "postgres",
  password: System.get_env("DATABASE_PASSWORD"),
  database: "statcasters_prod",
  socket: "/tmp/cloudsql/statcasters:us-central1:statcastersdb",
  pool_size: 20

我不确定我还能提供什么信息?有人知道我在这里可能会想念什么吗?

I'm not sure what more information I can give? Does anybody know what I could be missing here?

推荐答案

App Engine有2种版本,因此请参见此处链接的说明:

There are 2 flavors of App Engine so please see the instructions linked here: https://cloud.google.com/sql/docs/postgres/connect-app-engine

套接字名称似乎包含冗余的"/tmp"前缀,对于App Engine标准,该套接字名称应以"/cloudsql/..."开头.

The socket name appears to include a redundant "/tmp" prefix and should start with "/cloudsql/..." for App Engine standard.

这篇关于无法连接到数据库-设置GCP应用引擎的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆