Michiel van Oosterhout
Michiel van Oosterhout

Reputation: 23084

How do I get Solr back up when indexes are locked and <unlockOnStartup>true doesn't work?

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?

Upvotes: 9

Views: 15484

Answers (6)

Pier A
Pier A

Reputation: 171

My experience as I was a bit confused by the write.log with the .log ending in some answers (I was expecting a .lock ending).

I simply followed the instruction given by Solr:

Index dir '/var/solr/data/coreName/data/index/' of core 'coreName' is already locked. The most likely cause is another Solr server (or another solr core in this server)

Then I went to the directory /var/solr/data/coreName I searched find . -iname '*lock' and then delete those files that were clearly lock files.

Restarted solr and it worked.

Upvotes: 0

Raju Paladiya
Raju Paladiya

Reputation: 818

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

Upvotes: 1

Babu
Babu

Reputation: 5250

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

Upvotes: 6

Hieu Le
Hieu Le

Reputation: 2136

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

Upvotes: 3

Bijan
Bijan

Reputation: 6772

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

Upvotes: 1

sasikt
sasikt

Reputation: 5598

Clear the index directory and restart solr. It will work

Upvotes: 4

Related Questions