Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Capistrano postgresql:致命:用户的对等身份验证失败_Ruby On Rails_Postgresql_Deployment_Capistrano_Unicorn - Fatal编程技术网

Ruby on rails Capistrano postgresql:致命:用户的对等身份验证失败

Ruby on rails Capistrano postgresql:致命:用户的对等身份验证失败,ruby-on-rails,postgresql,deployment,capistrano,unicorn,Ruby On Rails,Postgresql,Deployment,Capistrano,Unicorn,我第一次在digital ocean上部署应用程序,遇到了两个(可能更多)问题 1) 在将gem'unicorn'添加到gem文件后,我无法捆绑安装。我发现kgio与windows不兼容。当我通过capistrano部署时,是否必须有Gemfile.lock?我将如何解决这个问题 group :production do gem 'pg', '0.14.1' gem "nginx" gem 'unicorn' end 2) 我在服务器上对postgresql进行身份验证时遇到问题

我第一次在digital ocean上部署应用程序,遇到了两个(可能更多)问题

1) 在将
gem'unicorn'
添加到gem文件后,我无法
捆绑安装。我发现kgio与windows不兼容。当我通过capistrano部署时,是否必须有Gemfile.lock?我将如何解决这个问题

group :production do
  gem 'pg', '0.14.1'
  gem "nginx"
  gem 'unicorn'
end
2) 我在服务器上对postgresql进行身份验证时遇到问题

production:
  adapter: postgresql
  encoding: unicode
  database: postgresql
  pool: 5
  username: postgresql
  password: secret
我运行了以下命令(以及其他一些变体):

每次cap部署时,都会出现以下错误:

FATAL: Peer authentication failed for user "postgresql"
我试图输入一个我知道不存在的无效用户名,一个无效的数据库,但错误消息总是相同的。根据postgresql网站,我应该得到不同的错误为那些


如果我能得到一些帮助,那太棒了。谢谢大家!

您必须首先设置Postgres。您通常在文件中这样做

只要只允许输入密码,密码对你没有好处。您只能以系统用户对应的db用户身份登录

顺便说一句,用户通常被称为postgres,而不是postgresql,这不是打字错误,是吗

您可以在shell中尝试:

sudo su - postgres
然后以
postgres
db用户身份登录,如果我的假设成立,将自动授权

更多详情请参见此处:


您需要为密码验证指定主机

production:
  adapter: postgresql
  encoding: unicode
  database: postgresql
  pool: 5
  host: localhost
  username: postgresql
  password: secret
更多细节

production:
  adapter: postgresql
  encoding: unicode
  database: postgresql
  pool: 5
  host: localhost
  username: postgresql
  password: secret