📣 极限科技诚招搜索运维工程师(Elasticsearch/Easysearch)- 全职/北京 👉 : 立即申请加入

版本: 7.1-8.9

简而言之,当 Elasticsearch 尝试在已设置为只读的仓库上创建快照时,会出现此错误。这可能是由于权限不正确或配置问题导致的。要解决此问题,您可以更改仓库设置以允许写操作。或者,您可以创建一个具有正确权限的新仓库,并将其用于快照。此外,确保 Elasticsearch 用户具有写入仓库的必要权限。

日志上下文 #

日志 “cannot snapshot shard on a readonly repository”(无法在只读仓库上创建分片快照)的类名是 BlobStoreRepository.java。我们从 Elasticsearch 源代码中提取了以下内容,供那些需要深入了解上下文的人参考:

shardSnapshotTaskRunner.enqueueShardSnapshot(context);
 }  private void doSnapshotShard(SnapshotShardContext context) {
 if (isReadOnly()) {
 context.onFailure(new RepositoryException(metadata.name(); "cannot snapshot shard on a readonly repository"));
 return;
 }
 final Store store = context.store();
 final ShardId shardId = store.shardId();
 final SnapshotId snapshotId = context.snapshotId();