新手问题 Errno::ECONNREFUSED - Connection refused - connect (2):

fayake · 2013年09月23日 · 最后由 fayake 回复于 2014年07月22日 · 7247 次阅读
Errno::ECONNREFUSED - Connection refused - connect(2):
  /home/zk/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:762:in `initialize'
  /home/zk/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:762:in `open'
  /home/zk/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:762:in `block in connect'
  /home/zk/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/timeout.rb:54:in `timeout'
  /home/zk/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/timeout.rb:99:in `timeout'
  /home/zk/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:762:in `connect'
  /home/zk/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:755:in `do_start'
  /home/zk/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:744:in `start'
  (gem) rest-client-1.6.7/lib/restclient/request.rb:172:in `transmit'
  (gem) rest-client-1.6.7/lib/restclient/request.rb:64:in `execute'
  (gem) rest-client-1.6.7/lib/restclient/request.rb:33:in `execute'
  (gem) rest-client-1.6.7/lib/restclient.rb:84:in `delete'
  /home/zk/.rvm/gems/ruby-1.9.3-p194@rails325/bundler/gems/tire-068e0ef806d1/lib/tire/http/client.rb:35:in `delete'
  /home/zk/.rvm/gems/ruby-1.9.3-p194@rails325/bundler/gems/tire-068e0ef806d1/lib/tire/index.rb:239:in `remove'
  app/models/room.rb:64:in `block in <class:Room>'
  (gem) activesupport-3.2.5/lib/active_support/callbacks.rb:438:in `_run__1171930461967550138__save__2057012583402831811__callbacks'
  (gem) activesupport-3.2.5/lib/active_support/callbacks.rb:405:in `__run_callback'
  (gem) activesupport-3.2.5/lib/active_support/callbacks.rb:385:in `_run_save_callbacks'
  (gem) activesupport-3.2.5/lib/active_support/callbacks.rb:81:in `run_callbacks'
  (gem) activerecord-3.2.5/lib/active_record/callbacks.rb:264:in `create_or_update'
  (gem) activerecord-3.2.5/lib/active_record/persistence.rb:84:in `save'
  (gem) activerecord-3.2.5/lib/active_record/validations.rb:50:in `save'
  (gem) activerecord-3.2.5/lib/active_record/attribute_methods/dirty.rb:22:in `save'
  (gem) activerecord-3.2.5/lib/active_record/transactions.rb:241:in `block (2 levels) in save'
  (gem) activerecord-3.2.5/lib/active_record/transactions.rb:295:in `block in with_transaction_returning_status'
  (gem) activerecord-3.2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
  (gem) activerecord-3.2.5/lib/active_record/transactions.rb:208:in `transaction'
  (gem) activerecord-3.2.5/lib/active_record/transactions.rb:293:in `with_transaction_returning_status'
  (gem) activerecord-3.2.5/lib/active_record/transactions.rb:241:in `block in save'
  (gem) activerecord-3.2.5/lib/active_record/transactions.rb:252:in `rollback_active_record_state!'
  (gem) activerecord-3.2.5/lib/active_record/transactions.rb:240:in `save'
  (gem) activerecord-3.2.5/lib/active_record/persistence.rb:213:in `block in update_attributes'
  (gem) activerecord-3.2.5/lib/active_record/transactions.rb:295:in `block in with_transaction_returning_status'
  (gem) activerecord-3.2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
  (gem) activerecord-3.2.5/lib/active_record/transactions.rb:208:in `transaction'
  (gem) activerecord-3.2.5/lib/active_record/transactions.rb:293:in `with_transaction_returning_status'
  (gem) activerecord-3.2.5/lib/active_record/persistence.rb:211:in `update_attributes'
  app/controllers/owner/rooms_controller.rb:145:in `block in update'
  (gem) actionpack-3.2.5/lib/action_controller/metal/mime_responds.rb:270:in `call'
  (gem) actionpack-3.2.5/lib/action_controller/metal/mime_responds.rb:270:in `retrieve_collector_from_mimes'
  (gem) actionpack-3.2.5/lib/action_controller/metal/mime_responds.rb:194:in `respond_to'
  app/controllers/owner/rooms_controller.rb:136:in `update'
  (gem) actionpack-3.2.5/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
  (gem) actionpack-3.2.5/lib/abstract_controller/base.rb:167:in `process_action'
  (gem) actionpack-3.2.5/lib/action_controller/metal/rendering.rb:10:in `process_action'
  (gem) actionpack-3.2.5/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
  (gem) activesupport-3.2.5/lib/active_support/callbacks.rb:502:in `_run__772940115473258373__process_action__4558156901286805944__callbacks'
  (gem) activesupport-3.2.5/lib/active_support/callbacks.rb:405:in `__run_callback'
  (gem) activesupport-3.2.5/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
  (gem) activesupport-3.2.5/lib/active_support/callbacks.rb:81:in `run_callbacks'
  (gem) actionpack-3.2.5/lib/abstract_controller/callbacks.rb:17:in `process_action'
  (gem) actionpack-3.2.5/lib/action_controller/metal/rescue.rb:29:in `process_action'
  (gem) actionpack-3.2.5/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
  (gem) activesupport-3.2.5/lib/active_support/notifications.rb:123:in `block in instrument'
  (gem) activesupport-3.2.5/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  (gem) activesupport-3.2.5/lib/active_support/notifications.rb:123:in `instrument'
  (gem) actionpack-3.2.5/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
  (gem) actionpack-3.2.5/lib/action_controller/metal/params_wrapper.rb:206:in `process_action'
  (gem) activerecord-3.2.5/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
  (gem) actionpack-3.2.5/lib/abstract_controller/base.rb:121:in `process'
  (gem) actionpack-3.2.5/lib/abstract_controller/rendering.rb:45:in `process'
  (gem) actionpack-3.2.5/lib/action_controller/metal.rb:203:in `dispatch'
  (gem) actionpack-3.2.5/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
  (gem) actionpack-3.2.5/lib/action_controller/metal.rb:246:in `block in action'
  (gem) actionpack-3.2.5/lib/action_dispatch/routing/route_set.rb:73:in `call'
  (gem) actionpack-3.2.5/lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
  (gem) actionpack-3.2.5/lib/action_dispatch/routing/route_set.rb:36:in `call'
  (gem) journey-1.0.4/lib/journey/router.rb:68:in `block in call'
  (gem) journey-1.0.4/lib/journey/router.rb:56:in `each'
  (gem) journey-1.0.4/lib/journey/router.rb:56:in `call'
  (gem) actionpack-3.2.5/lib/action_dispatch/routing/route_set.rb:600:in `call'
  (gem) meta_request-0.2.1/lib/meta_request/middlewares/app_request_handler.rb:11:in `call'
  (gem) rack-contrib-1.1.0/lib/rack/contrib/response_headers.rb:17:in `call'
  (gem) meta_request-0.2.1/lib/meta_request/middlewares/headers.rb:16:in `call'
  (gem) meta_request-0.2.1/lib/meta_request/middlewares/meta_request_handler.rb:13:in `call'
  (gem) better_errors-0.3.2/lib/better_errors/middleware.rb:51:in `app_call'
  (gem) better_errors-0.3.2/lib/better_errors/middleware.rb:45:in `call'
  (gem) rack-mobile-detect-0.4.0/lib/rack/mobile-detect.rb:164:in `call'
  (gem) actionpack-3.2.5/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
  (gem) rack-1.4.1/lib/rack/etag.rb:23:in `call'
  (gem) rack-1.4.1/lib/rack/conditionalget.rb:35:in `call'
  (gem) actionpack-3.2.5/lib/action_dispatch/middleware/head.rb:14:in `call'
  (gem) actionpack-3.2.5/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
  (gem) actionpack-3.2.5/lib/action_dispatch/middleware/flash.rb:238:in `call'
  (gem) rack-1.4.1/lib/rack/session/abstract/id.rb:205:in `context'
  (gem) rack-1.4.1/lib/rack/session/abstract/id.rb:200:in `call'
  (gem) actionpack-3.2.5/lib/action_dispatch/middleware/cookies.rb:338:in `call'
  (gem) activerecord-3.2.5/lib/active_record/query_cache.rb:64:in `call'
  (gem) activerecord-3.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:473:in `call'
  (gem) actionpack-3.2.5/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
  (gem) activesupport-3.2.5/lib/active_support/callbacks.rb:405:in `_run__3005215867121456336__call__2057012583402831811__callbacks'
  (gem) activesupport-3.2.5/lib/active_support/callbacks.rb:405:in `__run_callback'
  (gem) activesupport-3.2.5/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
  (gem) activesupport-3.2.5/lib/active_support/callbacks.rb:81:in `run_callbacks'
  (gem) actionpack-3.2.5/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  (gem) actionpack-3.2.5/lib/action_dispatch/middleware/reloader.rb:65:in `call'
  (gem) actionpack-3.2.5/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
  (gem) actionpack-3.2.5/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
  (gem) actionpack-3.2.5/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  (gem) railties-3.2.5/lib/rails/rack/logger.rb:26:in `call_app'
  (gem) railties-3.2.5/lib/rails/rack/logger.rb:16:in `call'
  (gem) quiet_assets-1.0.1/lib/quiet_assets.rb:20:in `call_with_quiet_assets'
  (gem) actionpack-3.2.5/lib/action_dispatch/middleware/request_id.rb:22:in `call'
  (gem) rack-1.4.1/lib/rack/methodoverride.rb:21:in `call'
  (gem) rack-1.4.1/lib/rack/runtime.rb:17:in `call'
  (gem) activesupport-3.2.5/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  (gem) rack-1.4.1/lib/rack/lock.rb:15:in `call'
  (gem) actionpack-3.2.5/lib/action_dispatch/middleware/static.rb:62:in `call'
  (gem) airbrake-3.1.6/lib/airbrake/rack.rb:41:in `call'
  (gem) airbrake-3.1.6/lib/airbrake/user_informer.rb:12:in `call'
  (gem) railties-3.2.5/lib/rails/engine.rb:479:in `call'
  (gem) railties-3.2.5/lib/rails/application.rb:220:in `call'
  (gem) rack-1.4.1/lib/rack/content_length.rb:14:in `call'
  (gem) railties-3.2.5/lib/rails/rack/log_tailer.rb:17:in `call'
  (gem) thin-1.5.1/lib/thin/connection.rb:81:in `block in pre_process'
  (gem) thin-1.5.1/lib/thin/connection.rb:79:in `catch'
  (gem) thin-1.5.1/lib/thin/connection.rb:79:in `pre_process'
  (gem) thin-1.5.1/lib/thin/connection.rb:54:in `process'
  (gem) thin-1.5.1/lib/thin/connection.rb:39:in `receive_data'
  (gem) eventmachine-1.0.3/lib/eventmachine.rb:187:in `run_machine'
  (gem) eventmachine-1.0.3/lib/eventmachine.rb:187:in `run'
  (gem) thin-1.5.1/lib/thin/backends/base.rb:63:in `start'
  (gem) thin-1.5.1/lib/thin/server.rb:159:in `start'
  (gem) rack-1.4.1/lib/rack/handler/thin.rb:13:in `run'
  (gem) rack-1.4.1/lib/rack/server.rb:265:in `start'
  (gem) railties-3.2.5/lib/rails/commands/server.rb:70:in `start'
  (gem) railties-3.2.5/lib/rails/commands.rb:55:in `block in <top (required)>'
  (gem) railties-3.2.5/lib/rails/commands.rb:50:in `tap'
  (gem) railties-3.2.5/lib/rails/commands.rb:50:in `<top (required)>'
  script/rails:6:in `require'
  script/rails:6:in `<main>'

网上找了好久没有解决,谁有类似问题的解决办法呀,我是在GIT上面下载的

共收到 9 条回复

网络问题,可能不是代码的问题。

#1楼 @lgn21st 我估计就配置问题,但找不到问题所在,网上查有说数据库,真的无从下手

#2楼 @fayake 通常遇到这个问题,你需要自己手动去验证一下远程服务是否 available,比如用 curl 去查一下你指定的地址是否可以访问,传参数过去是否能正常被处理,如果这些都正常的话,才需要在你的代码中找原因。

楼主这是没装 elasticsearch 吧?

重新格式化了一下代码,看到用了 tire,应该是 elasticsearch 的问题。

#4楼 @_samqiu 佩服死你们了,

#7楼 @fayake 怎么解决的? 只是装上elasticsearch就可以吗?

#8楼 @winter 是的,你按我这个网址的做试下

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册