posgresql无法连接到:意外的错误,同时处理的请求:无法连接到服务器:没有这样的文件或目录
问题描述:
我下面亚马逊EC2面临的一个很奇怪的问题,PostgreSQL是错误:posgresql无法连接到:意外的错误,同时处理的请求:无法连接到服务器:没有这样的文件或目录
Unexpected error while processing request: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
/bundle/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:671:in `initialize'
/bundle/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:671:in `new'
/bundle/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:671:in `connect'
/bundle/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:217:in `initialize'
/bundle/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:37:in `new'
/bundle/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:37:in `postgresql_connection'
我可以通过psql通过psql命令登录到AWS EC2实例,但是当它使用我的Rails应用程序时,它不起作用,可能是什么问题?
我为我的应用程序部署使用AWS + EC2 + Docker + RDS。
的database.yml
default: &default
adapter: postgresql
encoding: unicode
pool: 5
timeout: 5000
development:
<<: *default
database: <%= Figaro.env.rds_db_name || Figaro.env.database_name %>
host: <%= Figaro.env.rds_hostname || Figaro.env.database_host %>
port: <%= Figaro.env.rds_port || Figaro.env.database_port %>
username: <%= Figaro.env.rds_username || Figaro.env.database_username %>
password: <%= Figaro.env.rds_password || Figaro.env.database_password %>
test:
<<: *default
database: cluetap_test
dev:
<<: *default
database: <%= Figaro.env.database_name %>
staging:
<<: *default
database: <%= Figaro.env.rds_db_name || Figaro.env.database_name %>
host: <%= Figaro.env.rds_hostname || Figaro.env.database_host %>
port: <%= Figaro.env.rds_port || Figaro.env.database_port %>
username: <%= Figaro.env.rds_username || Figaro.env.database_username %>
password: <%= Figaro.env.rds_password || Figaro.env.database_password %>
production:
<<: *default
database: <%= Figaro.env.rds_db_name || Figaro.env.database_name %>
host: <%= Figaro.env.rds_hostname || Figaro.env.database_host %>
port: <%= Figaro.env.rds_port || Figaro.env.database_port %>
username: <%= Figaro.env.rds_username || Figaro.env.database_username %>
password: <%= Figaro.env.rds_password || Figaro.env.database_password %>
答
这是与安全组的问题,所以我已经更新它,然后它工作正常。
这是安全组问题中的9次。 – Asdfg
那我该怎么办?我对AWS + RDS + EC2 –
非常新,修复您的安全组。 – Asdfg