一、错误信息
org.apache.solr.common.SolrException: SolrCore 'collection1' is not available due to init failure:Index locked for write for core collection1
at org.apache.solr.core.CoreContainer.getCore(CoreContainer.java:753)
at org.apache.solr.client.solrj.embedded.EmbeddedSolrServer.request(EmbeddedSolrServer.java:110)
at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:91)
at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:301)
at cn.com.test.TestEmbedded.test(TestEmbedded.java:30)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
............................
...........................
Caused by: org.apache.lucene.store.LockObtainFailedException: Index locked for write for core collection1
at org.apache.solr.core.SolrCore.initIndex(SolrCore.java:505)
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:774)
二、原因
由于不正常操作,使solr索引处于锁定状态
三、处理方法
关闭启动时锁定
1、修改solrhome下/collection1/conf/solrconfig.xml(命令: vi /solrhome/collection1/conf/solrconfig.xml) 2、释放标签: false 并将false改为true(查找命令: /unlock)
3、如图所示: