I am facing a very strange problem with PostgreSQL on Amazon EC2 below is the error:
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'
I am able to log in from ssh through psql command to the AWS EC2 instance but when it is using my rails app it's not working, what could be the issue?
I am using AWS+EC2+Docker+RDS for my app deployment.
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 %>
这是安全组的问题,因此我已对其进行了更新,然后它可以正常工作。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.