RSolr :: Error :: Http - 500内部服务器错误

时间:2017-06-19 20:43:07

标签: ruby-on-rails-4 rspec sunspot-rails solr5 semaphore-ci

我正在升级solr 5.3.1,当我在semaphoreci上运行规范时出现以下错误

  

RSolr ::错误:: HTTP:          RSolr :: Error :: Http - 500内部服务器错误          错误:{msg =由于init失败,SolrCore'default'不可用:打开新错误   搜索者,trace = org.apache.solr.common.SolrException:SolrCore   由于init失败,'default'不可用:错误   开设新的搜索者             在org.apache.solr.core.CoreContainer.getCore(CoreContainer.java:974)             在org.apache.solr.servlet.HttpSolrCall.init(HttpSolrCall.java:250)             在org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:417)             在org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:214)             在org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:179)             在org.eclipse.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1652)             在org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)             在org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)             在org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)             在org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)

   URI: http://localhost:8981/solr/default/update?wt=json
   Request Headers: {"Content-Type"=>"application/json"}
   Request Data: "[{\"id\":\"Contact 1\",\"type\":[\"Contact\",\"ActiveRecord::Base\"],\"class_name\":\"Contact\",\"first_name_text\":\"Danial\",\"last_name_text\":\"Ullrich\"}]"

   Backtrace: /home/runner/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rsolr-2.0.2/lib/rsolr/client.rb:195:in
     

rescue in execute' /home/runner/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rsolr-2.0.2/lib/rsolr/client.rb:185:in 执行”          /home/runner/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rsolr-2.0.2/lib/rsolr/client.rb:180:in   send_and_receive_with_as_instrumentation中的send_and_receive' /home/runner/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sunspot_rails-2.2.7/lib/sunspot/rails/solr_instrumentation.rb:16:in 阻止          /home/runner/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/notifications.rb:164:in   block in instrument' /home/runner/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/notifications/instrumenter.rb:20:in 仪器”          /home/runner/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/notifications.rb:164:in   instrument' /home/runner/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sunspot_rails-2.2.7/lib/sunspot/rails/solr_instrumentation.rb:15:in send_and_receive_with_as_instrumentation”          (eval):2:post' /home/runner/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rsolr-2.0.2/lib/rsolr/client.rb:83:in 更新'          /home/runner/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rsolr-2.0.2/lib/rsolr/client.rb:102:in   add' # (eval):2:in交”        #./spec/controllers/contacts_controller_spec.rb:319:in block (3 levels) in <top (required)>' # ------------------ # --- Caused by: --- # Faraday::ClientError: # the server responded with status 500 # (eval):2:in发布'

Solr Logs

1152 ERROR (coreLoadExecutor-6-thread-2) [   x:development] o.a.s.c.CoreContainer Error creating core [development]: Index locked for write for core 'development'. Solr now longer supports forceful unlocking via 'unlockOnStartup'. Please verify locks manually!
org.apache.solr.common.SolrException: Index locked for write for core 'development'. Solr now longer supports forceful unlocking via 'unlockOnStartup'. Please verify locks manually!
  at org.apache.solr.core.SolrCore.<init>(SolrCore.java:820)
  at org.apache.solr.core.SolrCore.<init>(SolrCore.java:659)
  at org.apache.solr.core.CoreContainer.create(CoreContainer.java:723)
  at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:443)
  at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:434)
  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  at org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor$1.run(ExecutorUtil.java:210)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.lucene.store.LockObtainFailedException: Index locked for write for core 'development'. Solr now longer supports forceful unlocking via 'unlockOnStartup'. Please verify locks manually!
  at org.apache.solr.core.SolrCore.initIndex(SolrCore.java:528)
  at org.apache.solr.core.SolrCore.<init>(SolrCore.java:761)

非常感谢任何帮助。

2 个答案:

答案 0 :(得分:3)

由于不干净关闭,

write.lock文件可能出现在solr/{environment}/data/index目录下。删除write.lock文件将解决问题。

答案 1 :(得分:0)

即使没有write.lock,我也遇到了这个问题。这是为我解决的问题:

1)删除整个/ solr目录

2)运行ps -ef|grep solr来查看正在运行的所有solr进程

3)为步骤2中找到的每个进程运行kill -9 [solr pid]

4)运行rake sunspot:solr:start,然后运行rake sunspot:solr:reindex

希望这会有所帮助!