0
我下面亞馬遜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