Ruby on rails 在AWS上部署capistrano期间无法对postgres用户进行身份验证
我正在尝试将rails应用程序部署到AWS。部署失败Ruby on rails 在AWS上部署capistrano期间无法对postgres用户进行身份验证,ruby-on-rails,postgresql,amazon-web-services,capistrano,Ruby On Rails,Postgresql,Amazon Web Services,Capistrano,我正在尝试将rails应用程序部署到AWS。部署失败 PG::ConnectionBad: FATAL: Ident authentication failed for user "postgres" 我的database.yml文件(由capistrano从我的应用程序根目录下的共享目录合并)如下所示 production: adapter: postgresql encoding: unicode database: tpms_prod username: postgres
PG::ConnectionBad: FATAL: Ident authentication failed for user "postgres"
我的database.yml
文件(由capistrano从我的应用程序根目录下的共享目录合并)如下所示
production:
adapter: postgresql
encoding: unicode
database: tpms_prod
username: postgres
host: 127.0.0.1
port: 5432
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
host all all 127.0.0.1/32 ident
# IPv6 local connections:
host all all ::1/128 ident
而pg_hba.conf
是默认值,如下所示
production:
adapter: postgresql
encoding: unicode
database: tpms_prod
username: postgres
host: 127.0.0.1
port: 5432
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
host all all 127.0.0.1/32 ident
# IPv6 local connections:
host all all ::1/128 ident
我已尝试将pg_hba.conf
中的身份验证设置更改为password
,但仍报告身份验证失败
我尝试向数据库中添加一个新的超级用户,并在数据库.yml
文件中使用该用户-但是该用户的身份验证也失败,因此我知道部署进程正在使用数据库.yml
文件
如果我正确理解ident机制,那么请求连接的用户必须是声明的用户,这在命令行中得到证实 可能是错的。。。。但对我来说,ident意味着数据库(必须创建db用户)和客户端(这里是rails)之间必须有相同的用户名 这意味着如果你想让它工作,你应该以“postgres”用户的身份运行你的rails应用程序(这可能不是最好的主意)