Elasticsearch index write.lock error resolution——The road to dream building

ES error:

Caused by: org.apache.lucene.store.LockObtainFailedException: Lock held by another xxx write.lock 

This is because the ES is shut down abnormally, resulting in the index's write lock not being released, and the index has been in the red state.

Solution:

1. Stop the ES service

2. Find the corresponding data directory, find the location of the corresponding index write lock file write.lock, and delete the file

3. Start the ES service

If there are many indexes that should report errors, you can use batch processing.

Batch processing method:

1. Stop the ES service

2. Enter the data directory: cd nodes/0/

3. View the write lock: find . -name write.lock > lock_list.txt

4. Delete write locks in batches

#!/bin/bash
# delete write.lock

for i in `cat lock_list.txt`
do
    rm -f $i
done

Guess you like

Origin blog.csdn.net/qq_34777982/article/details/133126811