我有一个我目前正在处理的rails应用程序。我已经使用ubuntu 12.10部署到一个linode服务器,我得到了一个可爱的“我们很抱歉,但出了点问题。”信息。我一直在日志文件里面查看可能出错的任何迹象,但似乎没有任何错误。
已知
我一直在寻找stackoverflow试图找到任何相关的错误,但我还没有找到一个有效的解决方案。
提前感谢您的时间。
deployer@Asphodel:~/apps/TaskWebsite/current$ RAILS_ENV=production rake db:create
FATAL: password authentication failed for user "deployer"
FATAL: password authentication failed for user "deployer"
/home/deployer/apps/TaskWebsite/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/postgresql_adapter.rb:1213:in `initialize'
/home/deployer/apps/TaskWebsite/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/postgresql_adapter.rb:1213:in `new'
/home/deployer/apps/TaskWebsite/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/postgresql_adapter.rb:1213:in `connect'
/home/deployer/apps/TaskWebsite/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/postgresql_adapter.rb:329:in `initialize'
/home/deployer/apps/TaskWebsite/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `new'
/home/deployer/apps/TaskWebsite/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `postgresql_connection'
/home/deployer/apps/TaskWebsite/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:309:in `new_connection'
/home/deployer/apps/TaskWebsite/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:319:in `checkout_new_connection'
/home/deployer/apps/TaskWebsite/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:241:in `block (2 levels) in checkout'
/home/deployer/apps/TaskWebsite/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:236:in `loop'
/home/deployer/apps/TaskWebsite/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:236:in `block in checkout'
/usr/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/deployer/apps/TaskWebsite/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:233:in `checkout'
/home/deployer/apps/TaskWebsite/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:96:in `block in connection'
/usr/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/deployer/apps/TaskWebsite/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:95:in `connection'
/home/deployer/apps/TaskWebsite/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:404:in `retrieve_connection'
/home/deployer/apps/TaskWebsite/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:170:in `retrieve_connection'
/home/deployer/apps/TaskWebsite/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:144:in `connection'
/home/deployer/apps/TaskWebsite/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/railties/databases.rake:107:in `rescue in create_database'
/home/deployer/apps/TaskWebsite/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/railties/databases.rake:51:in `create_database'
/home/deployer/apps/TaskWebsite/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/railties/databases.rake:40:in `block (3 levels) in <top (required)>'
/home/deployer/apps/TaskWebsite/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/railties/databases.rake:40:in `each'
/home/deployer/apps/TaskWebsite/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/railties/databases.rake:40:in `block (2 levels) in <top (required)>'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/usr/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/usr/local/bin/rake:23:in `load'
/usr/local/bin/rake:23:in `<main>'
Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "database"=>"tasks_production", "pool"=>5, "host"=>"localhost", "user"=>"tasks", "password"=>"blahblah"}
答案 0 :(得分:1)
您的本地unix用户没有postgresql套接字的权限。要解决此问题,您应该授予本地访问权限,编辑/etc/postgresql/main/pg_hba.conf
,在关于#“local”的评论之后添加以下内容:
local all all trust
这将授予对此计算机上所有本地用户的访问权限。
保存文件并重新启动Postgresql - 你应该好好去。
答案 1 :(得分:0)
您的database.yml中的生产配置是什么样的?看起来用户指定的是“deployer”,如果群集中的用户是您提到的“任务”,那么这将是不正确的。如果用户名和密码是正确的,我会通过尝试通过其他客户端连接到群集来开始故障排除 - 我个人的偏好是只使用psql实用程序。您可以这样连接(假设psql在您的路径中) -
psql -h localhost -U deployer postgres
默认情况下,在新数据集群中创建“postgres”数据库。一旦您可以与其他客户端建立连接,请更新database.yml中的生产配置,并进行必要的更改,然后重试。
答案 2 :(得分:0)
在黑暗中刺伤......猜测'deployer'是操作系统用户?什么是Postgres的pg_hba.conf文件?
http://www.postgresql.org/docs/9.2/static/auth-pg-hba-conf.html
也许你只允许来自localhost的'peer'?看看下面的部分,特别是......
# 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 md5
# IPv6 local connections:
host all all ::1/128 md5