【问题标题】:rake sunspot:reindex rake aborted! RSolr::Error::Http - 404 Not Foundrake 太阳黑子:reindex rake 中止! RSolr::Error::Http - 404 未找到
【发布时间】:2013-10-29 11:45:25
【问题描述】:

我无法再重新编制索引,也无法解决此问题。 花几个小时在网上挖掘这个问题。 ** *关于生产环境* 开发顺利。 :(如何解决这个问题?

rake sunspot:reindex
rake aborted!
RSolr::Error::Http - 404 Not Found
Error:     Not Found

Request Data: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><delete><query>type:Match</query></delete>"

Backtrace: 

    /srv/books/shared/bundle/ruby/2.0.0/gems/rsolr-1.0.9/lib/rsolr/client.rb:268:in `adapt_response'
    /srv/books/shared/bundle/ruby/2.0.0/gems/rsolr-1.0.9/lib/rsolr/client.rb:175:in `execute'
    /srv/books/shared/bundle/ruby/2.0.0/gems/rsolr-1.0.9/lib/rsolr/client.rb:161:in `send_and_receive'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot_rails/lib/sunspot/rails/solr_instrumentation.rb:16:in `block in send_and_receive_with_as_instrumentation'
    /srv/books/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/notifications.rb:159:in `block in instrument'
    /srv/books/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
    /srv/books/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/notifications.rb:159:in `instrument'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot_rails/lib/sunspot/rails/solr_instrumentation.rb:15:in `send_and_receive_with_as_instrumentation'
    (eval):2:in `post'
    /srv/books/shared/bundle/ruby/2.0.0/gems/rsolr-1.0.9/lib/rsolr/client.rb:67:in `update'
    /srv/books/shared/bundle/ruby/2.0.0/gems/rsolr-1.0.9/lib/rsolr/client.rb:131:in `delete_by_query'/srv/books/shared/bundle/ruby/2.0.0/gems/rsolr-1.0.9/lib/rsolr/client.rb:268:in `adapt_response'
    /srv/books/shared/bundle/ruby/2.0.0/gems/rsolr-1.0.9/lib/rsolr/client.rb:175:in `execute'
    /srv/books/shared/bundle/ruby/2.0.0/gems/rsolr-1.0.9/lib/rsolr/client.rb:161:in `send_and_receive'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot_rails/lib/sunspot/rails/solr_instrumentation.rb:16:in `block in send_and_receive_with_as_instrumentation'
    /srv/books/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/notifications.rb:159:in `block in instrument'
    /srv/books/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
    /srv/books/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/notifications.rb:159:in `instrument'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot_rails/lib/sunspot/rails/solr_instrumentation.rb:15:in `send_and_receive_with_as_instrumentation'
    (eval):2:in `post'
    /srv/books/shared/bundle/ruby/2.0.0/gems/rsolr-1.0.9/lib/rsolr/client.rb:67:in `update'
    /srv/books/shared/bundle/ruby/2.0.0/gems/rsolr-1.0.9/lib/rsolr/client.rb:131:in `delete_by_query'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot/lib/sunspot/indexer.rb:57:in `remove_all'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot/lib/sunspot/session.rb:181:in `block in remove_all'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot/lib/sunspot/session.rb:181:in `each'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot/lib/sunspot/session.rb:181:in `remove_all'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot/lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `remove_all'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot/lib/sunspot/session_proxy/retry_5xx_session_proxy.rb:17:in `method_missing'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot/lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `remove_all'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot/lib/sunspot.rb:464:in `remove_all'
    /srv/books/shared/bundle/ruby/2.0.0/gems/newrelic_rpm-3.6.8.168/lib/new_relic/agent/method_tracer.rb:508:in `block in remove_all_with_trace_SolrClient_Sunspot_delete'
    /srv/books/shared/bundle/ruby/2.0.0/gems/newrelic_rpm-3.6.8.168/lib/new_relic/agent/method_tracer.rb:259:in `trace_execution_scoped'
    /srv/books/shared/bundle/ruby/2.0.0/gems/newrelic_rpm-3.6.8.168/lib/new_relic/agent/method_tracer.rb:503:in `remove_all_with_trace_SolrClient_Sunspot_delete'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot_rails/lib/sunspot/rails/searchable.rb:183:in `solr_remove_all_from_index'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot_rails/lib/sunspot/rails/searchable.rb:202:in `solr_reindex'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot_rails/lib/sunspot/rails/tasks.rb:57:in `block (4 levels) in <top (required)>'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot/lib/sunspot/class_set.rb:16:in `each'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot/lib/sunspot/class_set.rb:16:in `each'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot_rails/lib/sunspot/rails/tasks.rb:56:in `block (3 levels) in <top (required)>'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot_rails/lib/sunspot/rails/tasks.rb:68:in `with_session'
    /srv/books/shared/bundle/ruby/2.0.0/bundler/gems/sunspot-4e6c7870e3aa/sunspot_rails/lib/sunspot/rails/tasks.rb:19:in `block (2 levels) in <top (required)>'
    /usr/local/rvm/gems/ruby-2.0.0-p247@books/bin/ruby_executable_hooks:15:in `eval'
    /usr/local/rvm/gems/ruby-2.0.0-p247@books/bin/ruby_executable_hooks:15:in `<main>'
    Tasks: TOP => sunspot:reindex
    (See full trace by running task with --trace)

【问题讨论】:

  • 你能告诉我们,是什么改变导致 rake 任务失败? ruby-,rails-,gem-更新?你能试着缩小问题范围吗
  • 没有,想不起来了。我根据太阳黑子文档进行了全新安装,但仍然失败
  • 好吧,也许问题不仅与太阳黑子有关,因为回溯中的第一行之一是 delete_by_query'/srv/books/shared/bundle/ruby/2.0.0/gems/rsolr-1.0.9/lib/rsolr/client.rb:268:in adapt_response' 所以我建议将太阳黑子降级到以前的版本并检查是否问题仍在发生。对不起,但我的手被绑了:(
  • 您的日志文件向我暗示,这是在登台/生产环境中发生的。问题是否也在开发中出现?
  • 不,问题仅在生产中。我将更新我的帖子以澄清更多

标签: ruby-on-rails solr sunspot reindex


【解决方案1】:

这些是您应该遵循的终端命令来解决您的问题:

  1. ps aux | grep solr 获取 solr 进程 ID
  2. sudo kill &lt;ID&gt;,&lt;ID&gt;是你从1中找到的ID
  3. rm -r &lt;path/to/solr&gt;,删除项目中的 solr 目录以删除所有以前的索引
  4. RAILS_ENV=production bundle exec rake sunspot:solr:start
  5. 将路径更改为 /solr/defaultconfig/sunspot.yml
  6. RAILS_ENV=production bundle exec rake sunspot:solr:reindex

砰!问题解决了!我希望。

【讨论】:

    【解决方案2】:

    升级到 tomcat6 解决了这个问题 在我将 sunspot.yml 路径设置为 /solr/collection1 之后 并将scheme.xml从sunspot复制到/opt/solr/collection1/conf/scheme.xml

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-14
      相关资源
      最近更新 更多