How do I get Solr back up when indexes are locked

2019-03-27 17:47发布

问题:

I have a Solr slave that is running in Tomcat. I added a core, so I changed solr.xml. To reload it I decided to simply restart Tomcat using the Windows Services managament console.

After restarting Tomcat I keep getting the following exception:

org.apache.lucene.store.LockObtainFailedException: Index locked for write for core

I decided to temporarily change the solrconfig.xml for each core to add:

<unlockOnStartup>true</unlockOnStartup>

But no luck. Locking is set to native, so I can't go and remove lock files.

  1. How do I get Solr up and running again?
  2. How should I restart Solr to prevent this from happening?

回答1:

Clear the index directory and restart solr. It will work



回答2:

Delete only write.log in data/index . Where is data directory is specified in conf/solrconfig.xml.



回答3:

Delete file write.log in folder /data/index/ for your core then restart tomcat. It worked for me.



回答4:

In case the other answers don't work, check your file permissions. In my case, I had to do a

chown -R tomcat6:tomcat6 /opt/solr/corename



回答5:

Just deleted write.lock file under Solr > My Core > data > Index > write.lock file and restart solr server and it's worked.



标签: solr