Heroku Postgres数据库 - 拒绝连接

时间:2013-09-27 21:57:33

标签: ruby-on-rails postgresql heroku

(1.1ms)  BEGIN
  SQL (1.4ms)  INSERT INTO "table" ("somedata") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18) RETURNING (OTHER PROPRIETARY DATA)
   (1.0ms)  ROLLBACK
Errno::ECONNREFUSED: Connection refused - connect(2)
    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/net/http.rb:878:in `initialize'
    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/net/http.rb:878:in `open'
    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/net/http.rb:878:in `block in connect'
    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/timeout.rb:52:in `timeout'
    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/net/http.rb:877:in `connect'
    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/net/http.rb:862:in `do_start'
    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/net/http.rb:851:in `start'
    from /app/vendor/bundle/ruby/2.0.0/gems/rest-client-1.6.7/lib/restclient/request.rb:172:in `transmit'
    from /app/vendor/bundle/ruby/2.0.0/gems/rest-client-1.6.7/lib/restclient/request.rb:64:in `execute'
    from /app/vendor/bundle/ruby/2.0.0/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in `execute'
    from /app/vendor/bundle/ruby/2.0.0/gems/rest-client-1.6.7/lib/restclient.rb:72:in `post'
    from /app/vendor/bundle/ruby/2.0.0/gems/tire-0.5.8/lib/tire/http/client.rb:19:in `post'
    from /app/vendor/bundle/ruby/2.0.0/gems/tire-0.5.8/lib/tire/index.rb:143:in `store'
    from /app/vendor/bundle/ruby/2.0.0/gems/tire-0.5.8/lib/tire/model/search.rb:148:in `block in update_index'
    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:403:in `_run__648734676250133765__update_elasticsearch_index__2845407700799110590__callbacks'
    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:405:in `__run_callback'
... 10 levels...
    from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/validations.rb:50:in `save'
    from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/attribute_methods/dirty.rb:22:in `save'
    from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/transactions.rb:259:in `block (2 levels) in save'
    from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status'
    from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
    from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/transactions.rb:208:in `transaction'
    from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
    from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/transactions.rb:259:in `block in save'
    from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/transactions.rb:270:in `rollback_active_record_state!'
    from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/transactions.rb:258:in `save'
    from (irb):10
    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.14/lib/rails/commands/console.rb:47:in `start'
    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.14/lib/rails/commands/console.rb:8:in `start'
    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.14/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'

当我尝试从heroku run console保存到数据库时发生此错误...所以基本上我可以正常读取数据但无法写入任何数据我很困惑任何帮助?我可以包含任何其他必要的东西 - 包括我的database.yml文件......

1 个答案:

答案 0 :(得分:1)

看起来Tire gem中存在问题。我的猜测是,Tire正在尝试使用有关您正在更新的模型的索引数据来更新ElasticSearch。您是否在应用程序中配置了ES并正常工作?