rake db:migrate时,“getaddrinfo:名称或服务未知”

时间:2010-06-04 19:22:48

标签: ruby-on-rails postgresql rake

# rake db:migrate --trace
(in /www/rails_app)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
rake aborted!
getaddrinfo: Name or service not known
/usr/local/lib/ruby/gems/1.9.1/gems/postgres-pr-0.6.3/lib/postgres-pr/connection.rb:165:in `initialize'
/usr/local/lib/ruby/gems/1.9.1/gems/postgres-pr-0.6.3/lib/postgres-pr/connection.rb:165:in `new'
/usr/local/lib/ruby/gems/1.9.1/gems/postgres-pr-0.6.3/lib/postgres-pr/connection.rb:165:in `establish_connection'
/usr/local/lib/ruby/gems/1.9.1/gems/postgres-pr-0.6.3/lib/postgres-pr/connection.rb:51:in `initialize'
/usr/local/lib/ruby/gems/1.9.1/gems/postgres-pr-0.6.3/lib/postgres-pr/postgres-compat.rb:23:in `new'
/usr/local/lib/ruby/gems/1.9.1/gems/postgres-pr-0.6.3/lib/postgres-pr/postgres-compat.rb:23:in `initialize'
/getweb/ebr/vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:939:in `new'
/getweb/ebr/vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:939:in `connect'
/getweb/ebr/vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:217:in `initialize'
/getweb/ebr/vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:37:in `new'
/getweb/ebr/vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:37:in `postgresql_connection'
/getweb/ebr/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in `new_connection'
/getweb/ebr/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:245:in `checkout_new_connection'
/getweb/ebr/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:188:in `block (2 levels) in checkout'
/getweb/ebr/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in `loop'
/getweb/ebr/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in `block in checkout'
/usr/local/lib/ruby/1.9.1/monitor.rb:190:in `mon_synchronize'
/getweb/ebr/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:183:in `checkout'
/getweb/ebr/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:98:in `connection'
/getweb/ebr/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:326:in `retrieve_connection'
/getweb/ebr/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:123:in `retrieve_connection'
/getweb/ebr/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:115:in `connection'
/getweb/ebr/vendor/rails/activerecord/lib/active_record/migration.rb:440:in `initialize'
/getweb/ebr/vendor/rails/activerecord/lib/active_record/migration.rb:401:in `new'
/getweb/ebr/vendor/rails/activerecord/lib/active_record/migration.rb:401:in `up'
/getweb/ebr/vendor/rails/activerecord/lib/active_record/migration.rb:383:in `migrate'
/getweb/ebr/lib/tasks/data_fabric.rake:231:in `block (3 levels) in <top (required)>'
/getweb/ebr/lib/tasks/data_fabric.rake:218:in `each'
/getweb/ebr/lib/tasks/data_fabric.rake:218:in `block (2 levels) in <top (required)>'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:636:in `block in execute'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:597:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/monitor.rb:190:in `mon_synchronize'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `block (2 levels) in top_level'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `block in top_level'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2001:in `block in run'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.8.7/bin/rake:31:in `<top (required)>'
/usr/local/bin/rake:19:in `load'
/usr/local/bin/rake:19:in `<main>'

2 个答案:

答案 0 :(得分:0)

你之前是否正确安装了postgres gem?您可以尝试重新安装它。

答案 1 :(得分:0)

数据库配置中的服务器名称错误