在rails中连接到Cloud SQL Postgres时遇到很多麻烦

时间:2018-03-05 08:15:04

标签: ruby-on-rails postgresql google-cloud-platform google-cloud-sql

我已根据此guidedatabase.yml文件进行配置,但它始终返回错误:

计算引擎中的错误

  

PG :: ConnectionBad:无法连接到服务器:没有这样的文件或目录           服务器是在本地运行还是接受           Unix域套接字上的连接" / cloudsql / [YOUR_INSTANCE_CONNECTION_NAME] / .s.PGSQL.5432"?

我已将0.0.0.0/0的网络列入白名单,并在安装了云sql代理的情况下尝试了此guide,但仍然没有运气。

的database.yml

production:
  adapter: postgresql
  encoding: unicode
  pool: 5
  timeout: 5000
  database: databse-name
  username: <%= ENV['DATABASE_USERNAME'] %>
  password: <%= ENV['DATABASE_PASSWORD'] %>
  database: <%= ENV['DATABASE'] %>
  host: <%= ENV['DATABASE_HOST'] %>
  sslca: config/ssl/server-ca.pem
  sslcert: config/ssl/client-cert.pem
  sslkey: config/ssl/client-key.pem

0 个答案:

没有答案
相关问题