2015-12-09 2 views
0

je l'environnement suivant:Rails-taches solaires ne parvient pas à réindexer dans la production

Solr 5.3.1 Ubuntu 15.04 Rails 4.4.2 Sunspot rails

Mon exemple Solr est opérationnel et mon la collecte de la production a été créée en exécutant

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

de mon environnement de production, je vais en râteau pour réindexer et exécuter comme suit: rake sunspot:solr:reindex. Le résultat est le suivant http 400 erreur:

[email protected]:/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) 

Quelqu'un peut-il s'il vous plaît expliquer pourquoi cela se passe et comment je peux le réparer. En développement tout fonctionne bien. En production, ma collection de production est vide, essayant de réindexer mais elle échoue avec cette erreur de mauvaise requête 400.

Répondre

0

Eh bien j'ai raté un point de configuration important que je ne vois pas dans la documentation sur les pare-soleil. Lorsque vous exécutez la commande rake install pour sunspot-rails, un répertoire solr est créé dans le projet racine de votre rail.

Dans ce sont 2 fichiers importants:

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

Ces deux fichiers xml besoin copier dans le répertoire/var/Solr/data/production/conf - ou quel que soit le répertoire conf pour votre collection est. Quand je l'ai fait, redémarré solr et essayé de réindexer ça fonctionne! Voila.

+1

Lorsque vous avez exécuté la commande core create pour créer le core nommé "production", vous ne lui avez pas dit quel configset utiliser. Cela utilisera basic_configs ou data_driven_schema_configs, mais je ne sais pas lequel - il copiera l'information à partir de là vers le répertoire de production - pas le config/schema inclus avec sunspot-rails. – elyograg