簡體   English   中英

Sunspot-Rails無法在生產中重新編制索引

[英]Sunspot-Rails fails to reindex in production

我有以下環境:

Solr 5.3.1 Ubuntu 15.04 Rails 4.4.2 Sunspot-rails

我的solr實例已啟動並正在運行,並且通過運行來創建生產集合

/opt/solr/bin/solr create -c production

在生產環境中,我進入rake以便重新編制索引,並按如下所示運行: rake sunspot:solr:reindex 其結果是以下http 400錯誤:

deploy@vps194508:/opt/www/app1/current/bin$ bundle exec rake sunspot:solr:reindex
(in /opt/www/app1/releases/20151209181633)
Skipping progress bar: for progress reporting, add gem 'progress_bar' to your Gemfile
rake aborted!
RSolr::Error::Http: RSolr::Error::Http - 400 Bad Request
Error: {'responseHeader'=>{'status'=>400,'QTime'=>4},'error'=>{'msg'=>'undefined field type','code'=>400}}

URI: http://app1.com:8983/solr/production/update?wt=ruby
Request Headers: {"Content-Type"=>"text/xml"}
Request Data: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><delete><query>type:Event</query></delete>"

Backtrace: /opt/www/app1/shared/bundle/ruby/2.2.0/gems/rsolr-1.0.13/lib/rsolr/client.rb:284:in `adapt_response'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/rsolr-1.0.13/lib/rsolr/client.rb:190:in `execute'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/rsolr-1.0.13/lib/rsolr/client.rb:176:in `send_and_receive'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot_rails-2.2.2/lib/sunspot/rails/solr_instrumentation.rb:16:in `block in send_and_receive_with_as_instrumentation'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.2/lib/active_support/notifications.rb:164:in `block in instrument'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.2/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.2/lib/active_support/notifications.rb:164:in `instrument'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot_rails-2.2.2/lib/sunspot/rails/solr_instrumentation.rb:15:in `send_and_receive_with_as_instrumentation'
(eval):2:in `post'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/rsolr-1.0.13/lib/rsolr/client.rb:82:in `update'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/rsolr-1.0.13/lib/rsolr/client.rb:146:in `delete_by_query'/opt/www/app1/shared/bundle/ruby/2.2.0/gems/rsolr-1.0.13/lib/rsolr/client.rb:284:in `adapt_response'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/rsolr-1.0.13/lib/rsolr/client.rb:190:in `execute'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/rsolr-1.0.13/lib/rsolr/client.rb:176:in `send_and_receive'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot_rails-2.2.2/lib/sunspot/rails/solr_instrumentation.rb:16:in `block in send_and_receive_with_as_instrumentation'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.2/lib/active_support/notifications.rb:164:in `block in instrument'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.2/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/activesupport-4.2.2/lib/active_support/notifications.rb:164:in `instrument'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot_rails-2.2.2/lib/sunspot/rails/solr_instrumentation.rb:15:in `send_and_receive_with_as_instrumentation'
(eval):2:in `post'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/rsolr-1.0.13/lib/rsolr/client.rb:82:in `update'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/rsolr-1.0.13/lib/rsolr/client.rb:146:in `delete_by_query'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot-2.2.2/lib/sunspot/indexer.rb:68:in `remove_all'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot-2.2.2/lib/sunspot/session.rb:197:in `block in remove_all'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot-2.2.2/lib/sunspot/session.rb:197:in `each'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot-2.2.2/lib/sunspot/session.rb:197:in `remove_all'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot-2.2.2/lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `remove_all'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot-2.2.2/lib/sunspot/session_proxy/retry_5xx_session_proxy.rb:17:in `method_missing'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot-2.2.2/lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `remove_all'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot-2.2.2/lib/sunspot.rb:502:in `remove_all'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot_rails-2.2.2/lib/sunspot/rails/searchable.rb:190:in `solr_remove_all_from_index'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot_rails-2.2.2/lib/sunspot/rails/searchable.rb:209:in `solr_reindex'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot_rails-2.2.2/lib/sunspot/rails/tasks.rb:60:in `block (4 levels) in <top (required)>'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot-2.2.2/lib/sunspot/class_set.rb:16:in `each'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot-2.2.2/lib/sunspot/class_set.rb:16:in `each'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot_rails-2.2.2/lib/sunspot/rails/tasks.rb:59:in `block (3 levels) in <top (required)>'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot_rails-2.2.2/lib/sunspot/rails/tasks.rb:71:in `with_session'
/opt/www/app1/shared/bundle/ruby/2.2.0/gems/sunspot_rails-2.2.2/lib/sunspot/rails/tasks.rb:19:in `block (2 levels) in <top (required)>'
Tasks: TOP => sunspot:solr:reindex => sunspot:reindex
(See full trace by running task with --trace)

有人可以解釋一下為什么會發生這種情況以及我該如何解決。 在開發中,一切正常。 在生產中,我的生產集合為空,因此嘗試重新編制索引,但由於出現此錯誤請求400錯誤而失敗。

好吧,我錯過了在sunspot-rails文檔中沒有看到的重要配置點。

對sunspot-rails運行rake install命令時,它將在rails項目的根目錄中創建一個solr目錄。

其中有2個重要文件:

solr/configsets/sunspot/conf/schema.xml
solr/configsets/sunspot/conf/solrconfig.xml

這兩個xml文件都需要復制到/ var / solr / data / production / conf目錄-或集合中的任何conf目錄。 當我這樣做時,重新啟動solr並嘗試重新建立索引!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM