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

6

9

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?
Cuthbert answered 5/6, 2013 at 14:54 Comment(0)
P
4

Clear the index directory and restart solr. It will work

Prolongation answered 25/6, 2013 at 7:48 Comment(3)
Where can I find index directory?Shrieve
Inside your solr core folder there will be a directory named data and within that there will be a folder named indexProlongation
For others...I found files in ./example/solr/collection1/data/index/write.lock ./example/solr/development-edit/data/index/write.lock ./example/solr/development-live/data/index/write.lockRunofthemill
M
6

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

Moravian answered 22/2, 2014 at 0:29 Comment(1)
In case you are running as SolrCloud with HDFS, then the write lock is on hdfs path, and can be found via admin UI in location -> hdfs dfs -rm /my/path/write/lockMoravian
P
4

Clear the index directory and restart solr. It will work

Prolongation answered 25/6, 2013 at 7:48 Comment(3)
Where can I find index directory?Shrieve
Inside your solr core folder there will be a directory named data and within that there will be a folder named indexProlongation
For others...I found files in ./example/solr/collection1/data/index/write.lock ./example/solr/development-edit/data/index/write.lock ./example/solr/development-live/data/index/write.lockRunofthemill
H
3

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

Harelip answered 6/10, 2014 at 2:54 Comment(0)
R
1

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

Rusert answered 14/5, 2014 at 4:17 Comment(0)
S
1

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

Strontia answered 8/3, 2019 at 5:43 Comment(0)
C
0

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.

Coriss answered 23/3, 2023 at 12:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.