使用 man ascii 来查看 ASCII 表。

elastic 创建索引时 有的时候 分片会挂载不到索引上

Elasticsearch | 作者 mr01 | 发布于2017年01月06日 | 阅读数:7395

我在创建索引时 默认是 5个分片 1个备份,但有时候有一个分片会挂载不到索引上,elastic 日志会出现如下错误:
[2017-01-04 06:13:26,733][INFO ][cluster.metadata ] [node-113] [jycms-quesanswer] creating index, cause [api], templates [], shards [5]/[1], mappings []
[2017-01-04 06:13:27,091][WARN ][index.engine ] [node-113] [jycms-quesanswer][2] failed engine [lucene commit failed]
org.apache.lucene.store.AlreadyClosedException: Underlying file changed by an external force at 2017-01-04T06:13:26Z, (lock=NativeFSLock(path=/data/server/data/jyall-jygoods/nodes/0/indices/jycms-quesanswer/2/index/write.lock,impl=sun.nio.ch.FileLockImpl[0:9223372036854775807 exclusive valid],ctime=2017-01-04T06:13:26Z))
at org.apache.lucene.store.NativeFSLockFactory$NativeFSLock.ensureValid(NativeFSLockFactory.java:179)
at org.apache.lucene.store.LockValidatingDirectoryWrapper.createOutput(LockValidatingDirectoryWrapper.java:43)
at org.apache.lucene.index.SegmentInfos.write(SegmentInfos.java:516)
at org.apache.lucene.index.SegmentInfos.prepareCommit(SegmentInfos.java:809)
at org.apache.lucene.index.IndexWriter.startCommit(IndexWriter.java:4418)
at org.apache.lucene.index.IndexWriter.prepareCommitInternal(IndexWriter.java:2860)
at org.apache.lucene.index.IndexWriter.commitInternal(IndexWriter.java:2963)
at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:2930)
at org.elasticsearch.index.engine.InternalEngine.commitIndexWriter(InternalEngine.java:1256)
at org.elasticsearch.index.engine.InternalEngine.commitIndexWriter(InternalEngine.java:1264)
at org.elasticsearch.index.engine.InternalEngine.openTranslog(InternalEngine.java:214)
at org.elasticsearch.index.engine.InternalEngine.<init>(InternalEngine.java:148)
at org.elasticsearch.index.engine.InternalEngineFactory.newReadWriteEngine(InternalEngineFactory.java:25)
at org.elasticsearch.index.shard.IndexShard.newEngine(IndexShard.java:1509)
at org.elasticsearch.index.shard.IndexShard.createNewEngine(IndexShard.java:1493)
at org.elasticsearch.index.shard.IndexShard.internalPerformTranslogRecovery(IndexShard.java:966)
at org.elasticsearch.index.shard.IndexShard.performTranslogRecovery(IndexShard.java:938)
at org.elasticsearch.index.shard.StoreRecoveryService.recoverFromStore(StoreRecoveryService.java:241)
at org.elasticsearch.index.shard.StoreRecoveryService.access$100(StoreRecoveryService.java:56)
at org.elasticsearch.index.shard.StoreRecoveryService$1.run(StoreRecoveryService.java:129)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
[2017-01-04 06:13:27,103][WARN ][indices.cluster ] [node-113] [[jycms-quesanswer][2]] marking and sending shard failed due to [engine failure, reason [lucene commit failed]]
org.apache.lucene.store.AlreadyClosedException: Underlying file changed by an external force at 2017-01-04T06:13:26Z, (lock=NativeFSLock(path=/data/server/data/jyall-jygoods/nodes/0/indices/jycms-quesanswer/2/index/write.lock,impl=sun.nio.ch.FileLockImpl[0:9223372036854775807 exclusive valid],ctime=2017-01-04T06:13:26Z))
at org.apache.lucene.store.NativeFSLockFactory$NativeFSLock.ensureValid(NativeFSLockFactory.java:179)
at org.apache.lucene.store.LockValidatingDirectoryWrapper.createOutput(LockValidatingDirectoryWrapper.java:43)
at org.apache.lucene.index.SegmentInfos.write(SegmentInfos.java:516)
at org.apache.lucene.index.SegmentInfos.prepareCommit(SegmentInfos.java:809)
at org.apache.lucene.index.IndexWriter.startCommit(IndexWriter.java:4418)
at org.apache.lucene.index.IndexWriter.prepareCommitInternal(IndexWriter.java:2860)
at org.apache.lucene.index.IndexWriter.commitInternal(IndexWriter.java:2963)
at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:2930)
at org.elasticsearch.index.engine.InternalEngine.commitIndexWriter(InternalEngine.java:1256)
at org.elasticsearch.index.engine.InternalEngine.commitIndexWriter(InternalEngine.java:1264)
at org.elasticsearch.index.engine.InternalEngine.openTranslog(InternalEngine.java:214)
at org.elasticsearch.index.engine.InternalEngine.<init>(InternalEngine.java:148)
at org.elasticsearch.index.engine.InternalEngineFactory.newReadWriteEngine(InternalEngineFactory.java:25)
at org.elasticsearch.index.shard.IndexShard.newEngine(IndexShard.java:1509)
at org.elasticsearch.index.shard.IndexShard.createNewEngine(IndexShard.java:1493)
at org.elasticsearch.index.shard.IndexShard.internalPerformTranslogRecovery(IndexShard.java:966)
at org.elasticsearch.index.shard.IndexShard.performTranslogRecovery(IndexShard.java:938)
at org.elasticsearch.index.shard.StoreRecoveryService.recoverFromStore(StoreRecoveryService.java:241)
at org.elasticsearch.index.shard.StoreRecoveryService.access$100(StoreRecoveryService.java:56)
at org.elasticsearch.index.shard.StoreRecoveryService$1.run(StoreRecoveryService.java:129)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
[2017-01-04 06:13:27,104][WARN ][cluster.action.shard ] [node-113] [jycms-quesanswer][2] received shard failed for target shard [[jycms-quesanswer][2], node[yIGispUsS_-ZCgRNk5g55A], [P], v[1], s[INITIALIZING], a[id=RRvofPEJQBCFXK_84_28ew], unassigned_info[[reason=INDEX_CREATED], at[2017-01-04T06:13:26.750Z]]], indexUUID [w_IXJz6WRjK3ZrQFZQ5ZLQ], message [engine failure, reason [lucene commit failed]], failure [AlreadyClosedException[Underlying file changed by an external force at 2017-01-04T06:13:26Z, (lock=NativeFSLock(path=/data/server/data/jyall-jygoods/nodes/0/indices/jycms-quesanswer/2/index/write.lock,impl=sun.nio.ch.FileLockImpl[0:9223372036854775807 exclusive valid],ctime=2017-01-04T06:13:26Z))]]
org.apache.lucene.store.AlreadyClosedException: Underlying file changed by an external force at 2017-01-04T06:13:26Z, (lock=NativeFSLock(path=/data/server/data/jyall-jygoods/nodes/0/indices/jycms-quesanswer/2/index/write.lock,impl=sun.nio.ch.FileLockImpl[0:9223372036854775807 exclusive valid],ctime=2017-01-04T06:13:26Z))
at org.apache.lucene.store.NativeFSLockFactory$NativeFSLock.ensureValid(NativeFSLockFactory.java:179)
at org.apache.lucene.store.LockValidatingDirectoryWrapper.createOutput(LockValidatingDirectoryWrapper.java:43)
at org.apache.lucene.index.SegmentInfos.write(SegmentInfos.java:516)
at org.apache.lucene.index.SegmentInfos.prepareCommit(SegmentInfos.java:809)
at org.apache.lucene.index.IndexWriter.startCommit(IndexWriter.java:4418)
at org.apache.lucene.index.IndexWriter.prepareCommitInternal(IndexWriter.java:2860)
at org.apache.lucene.index.IndexWriter.commitInternal(IndexWriter.java:2963)
at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:2930)
at org.elasticsearch.index.engine.InternalEngine.commitIndexWriter(InternalEngine.java:1256)
at org.elasticsearch.index.engine.InternalEngine.commitIndexWriter(InternalEngine.java:1264)
at org.elasticsearch.index.engine.InternalEngine.openTranslog(InternalEngine.java:214)
at org.elasticsearch.index.engine.InternalEngine.<init>(InternalEngine.java:148)
at org.elasticsearch.index.engine.InternalEngineFactory.newReadWriteEngine(InternalEngineFactory.java:25)
at org.elasticsearch.index.shard.IndexShard.newEngine(IndexShard.java:1509)
at org.elasticsearch.index.shard.IndexShard.createNewEngine(IndexShard.java:1493)
at org.elasticsearch.index.shard.IndexShard.internalPerformTranslogRecovery(IndexShard.java:966)
at org.elasticsearch.index.shard.IndexShard.performTranslogRecovery(IndexShard.java:938)
at org.elasticsearch.index.shard.StoreRecoveryService.recoverFromStore(StoreRecoveryService.java:241)
at org.elasticsearch.index.shard.StoreRecoveryService.access$100(StoreRecoveryService.java:56)
at org.elasticsearch.index.shard.StoreRecoveryService$1.run(StoreRecoveryService.java:129)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
[2017-01-04 06:13:27,105][WARN ][indices.cluster ] [node-113] [[jycms-quesanswer][2]] marking and sending shard failed due to [failed recovery]
[jycms-quesanswer][[jycms-quesanswer][2]] IndexShardRecoveryException[failed recovery]; nested: AlreadyClosedException[Underlying file changed by an external force at 2017-01-04T06:13:26Z, (lock=NativeFSLock(path=/data/server/data/jyall-jygoods/nodes/0/indices/jycms-quesanswer/2/index/write.lock,impl=sun.nio.ch.FileLockImpl[0:9223372036854775807 exclusive valid],ctime=2017-01-04T06:13:26Z))];
at org.elasticsearch.index.shard.StoreRecoveryService$1.run(StoreRecoveryService.java:179)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.lucene.store.AlreadyClosedException: Underlying file changed by an external force at 2017-01-04T06:13:26Z, (lock=NativeFSLock(path=/data/server/data/jyall-jygoods/nodes/0/indices/jycms-quesanswer/2/index/write.lock,impl=sun.nio.ch.FileLockImpl[0:9223372036854775807 exclusive valid],ctime=2017-01-04T06:13:26Z))
at org.apache.lucene.store.NativeFSLockFactory$NativeFSLock.ensureValid(NativeFSLockFactory.java:179)
at org.apache.lucene.store.LockValidatingDirectoryWrapper.createOutput(LockValidatingDirectoryWrapper.java:43)
at org.apache.lucene.index.SegmentInfos.write(SegmentInfos.java:516)
at org.apache.lucene.index.SegmentInfos.prepareCommit(SegmentInfos.java:809)
at org.apache.lucene.index.IndexWriter.startCommit(IndexWriter.java:4418)
at org.apache.lucene.index.IndexWriter.prepareCommitInternal(IndexWriter.java:2860)
at org.apache.lucene.index.IndexWriter.commitInternal(IndexWriter.java:2963)
at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:2930)
at org.elasticsearch.index.engine.InternalEngine.commitIndexWriter(InternalEngine.java:1256)
at org.elasticsearch.index.engine.InternalEngine.commitIndexWriter(InternalEngine.java:1264)
at org.elasticsearch.index.engine.InternalEngine.openTranslog(InternalEngine.java:214)
at org.elasticsearch.index.engine.InternalEngine.<init>(InternalEngine.java:148)
at org.elasticsearch.index.engine.InternalEngineFactory.newReadWriteEngine(InternalEngineFactory.java:25)
at org.elasticsearch.index.shard.IndexShard.newEngine(IndexShard.java:1509)
at org.elasticsearch.index.shard.IndexShard.createNewEngine(IndexShard.java:1493)
at org.elasticsearch.index.shard.IndexShard.internalPerformTranslogRecovery(IndexShard.java:966)
at org.elasticsearch.index.shard.IndexShard.performTranslogRecovery(IndexShard.java:938)
at org.elasticsearch.index.shard.StoreRecoveryService.recoverFromStore(StoreRecoveryService.java:241)
at org.elasticsearch.index.shard.StoreRecoveryService.access$100(StoreRecoveryService.java:56)
at org.elasticsearch.index.shard.StoreRecoveryService$1.run(StoreRecoveryService.java:129)
... 3 more
[2017-01-04 06:13:27,106][WARN ][cluster.action.shard ] [node-113] [jycms-quesanswer][2] received shard failed for target shard [[jycms-quesanswer][2], node[yIGispUsS_-ZCgRNk5g55A], [P], v[1], s[INITIALIZING], a[id=RRvofPEJQBCFXK_84_28ew], unassigned_info[[reason=INDEX_CREATED], at[2017-01-04T06:13:26.750Z]]], indexUUID [w_IXJz6WRjK3ZrQFZQ5ZLQ], message [failed recovery], failure [IndexShardRecoveryException[failed recovery]; nested: AlreadyClosedException[Underlying file changed by an external force at 2017-01-04T06:13:26Z, (lock=NativeFSLock(path=/data/server/data/jyall-jygoods/nodes/0/indices/jycms-quesanswer/2/index/write.lock,impl=sun.nio.ch.FileLockImpl[0:9223372036854775807 exclusive valid],ctime=2017-01-04T06:13:26Z))]; ]
[jycms-quesanswer][[jycms-quesanswer][2]] IndexShardRecoveryException[failed recovery]; nested: AlreadyClosedException[Underlying file changed by an external force at 2017-01-04T06:13:26Z, (lock=NativeFSLock(path=/data/server/data/jyall-jygoods/nodes/0/indices/jycms-quesanswer/2/index/write.lock,impl=sun.nio.ch.FileLockImpl[0:9223372036854775807 exclusive valid],ctime=2017-01-04T06:13:26Z))];
at org.elasticsearch.index.shard.StoreRecoveryService$1.run(StoreRecoveryService.java:179)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.lucene.store.AlreadyClosedException: Underlying file changed by an external force at 2017-01-04T06:13:26Z, (lock=NativeFSLock(path=/data/server/data/jyall-jygoods/nodes/0/indices/jycms-quesanswer/2/index/write.lock,impl=sun.nio.ch.FileLockImpl[0:9223372036854775807 exclusive valid],ctime=2017-01-04T06:13:26Z))
at org.apache.lucene.store.NativeFSLockFactory$NativeFSLock.ensureValid(NativeFSLockFactory.java:179)
at org.apache.lucene.store.LockValidatingDirectoryWrapper.createOutput(LockValidatingDirectoryWrapper.java:43)
at org.apache.lucene.index.SegmentInfos.write(SegmentInfos.java:516)
at org.apache.lucene.index.SegmentInfos.prepareCommit(SegmentInfos.java:809)
at org.apache.lucene.index.IndexWriter.startCommit(IndexWriter.java:4418)
at org.apache.lucene.index.IndexWriter.prepareCommitInternal(IndexWriter.java:2860)
at org.apache.lucene.index.IndexWriter.commitInternal(IndexWriter.java:2963)
at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:2930)
at org.elasticsearch.index.engine.InternalEngine.commitIndexWriter(InternalEngine.java:1256)
at org.elasticsearch.index.engine.InternalEngine.commitIndexWriter(InternalEngine.java:1264)
at org.elasticsearch.index.engine.InternalEngine.openTranslog(InternalEngine.java:214)
at org.elasticsearch.index.engine.InternalEngine.<init>(InternalEngine.java:148)
at org.elasticsearch.index.engine.InternalEngineFactory.newReadWriteEngine(InternalEngineFactory.java:25)
at org.elasticsearch.index.shard.IndexShard.newEngine(IndexShard.java:1509)
at org.elasticsearch.index.shard.IndexShard.createNewEngine(IndexShard.java:1493)
at org.elasticsearch.index.shard.IndexShard.internalPerformTranslogRecovery(IndexShard.java:966)
at org.elasticsearch.index.shard.IndexShard.performTranslogRecovery(IndexShard.java:938)
at org.elasticsearch.index.shard.StoreRecoveryService.recoverFromStore(StoreRecoveryService.java:241)
at org.elasticsearch.index.shard.StoreRecoveryService.access$100(StoreRecoveryService.java:56)
at org.elasticsearch.index.shard.StoreRecoveryService$1.run(StoreRecoveryService.java:129)
... 3 more
[2017-01-04 06:13:27,235][WARN ][cluster.action.shard ] [node-113] [jycms-quesanswer][2] received shard failed for target shard [[jycms-quesanswer][2], node[yIGispUsS_-ZCgRNk5g55A], [P], v[1], s[INITIALIZING], a[id=RRvofPEJQBCFXK_84_28ew], unassigned_info[[reason=INDEX_CREATED], at[2017-01-04T06:13:26.750Z]]], indexUUID [w_IXJz6WRjK3ZrQFZQ5ZLQ], message [master {node-113}{yIGispUsS_-ZCgRNk5g55A}{10.10.32.113}{10.10.32.113:9300} marked shard as initializing, but shard is marked as failed, resend shard failure]
[2017-01-04 06:13:27,408][WARN ][cluster.action.shard ] [node-113] [jycms-quesanswer][2] received shard failed for target shard [[jycms-quesanswer][2], node[yIGispUsS_-ZCgRNk5g55A], [P], v[1], s[INITIALIZING], a[id=RRvofPEJQBCFXK_84_28ew], unassigned_info[[reason=INDEX_CREATED], at[2017-01-04T06:13:26.750Z]]], indexUUID [w_IXJz6WRjK3ZrQFZQ5ZLQ], message [master {node-113}{yIGispUsS_-ZCgRNk5g55A}{10.10.32.113}{10.10.32.113:9300} marked shard as initializing, but shard is marked as failed, resend shard failure]
[2017-01-04 06:13:27,580][WARN ][cluster.action.shard ] [node-113] [jycms-quesanswer][2] received shard failed for target shard [[jycms-quesanswer][2], node[yIGispUsS_-ZCgRNk5g55A], [P], v[1], s[INITIALIZING], a[id=RRvofPEJQBCFXK_84_28ew], unassigned_info[[reason=INDEX_CREATED], at[2017-01-04T06:13:26.750Z]]], indexUUID [w_IXJz6WRjK3ZrQFZQ5ZLQ], message [master {node-113}{yIGispUsS_-ZCgRNk5g55A}{10.10.32.113}{10.10.32.113:9300} marked shard as initializing, but shard is marked as failed, resend shard failure]
[2017-01-04 06:13:27,641][INFO ][cluster.metadata ] [node-113] [jycms-quesanswer] create_mapping [quesanswer]
[2017-01-04 06:13:27,681][WARN ][cluster.action.shard ] [node-113] [jycms-quesanswer][2] received shard failed for target shard [[jycms-quesanswer][2], node[yIGispUsS_-ZCgRNk5g55A], [P], v[1], s[INITIALIZING], a[id=RRvofPEJQBCFXK_84_28ew], unassigned_info[[reason=INDEX_CREATED], at[2017-01-04T06:13:26.750Z]]], indexUUID [w_IXJz6WRjK3ZrQFZQ5ZLQ], message [master {node-113}{yIGispUsS_-ZCgRNk5g55A}{10.10.32.113}{10.10.32.113:9300} marked shard as initializing, but shard is marked as failed, resend shard failure]
已邀请:

woniu5

赞同来自:

你的问题解决了吗?遇到了同样的问题。

yayg2008

赞同来自:

看异常原因,像是/data/server/data/jyall-jygoods/nodes/0/indices/jycms-quesanswer/2/index/write.lock 这个文件被外部编辑过,导致锁校验失败,无法继续。是有手工编辑过这个文件?

要回复问题请先登录注册