Cannot snapshot shard on a readonly repository – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 7.1-8.9

Briefly, this error occurs when Elasticsearch tries to create a snapshot on a repository that has been set to read-only. This could be due to incorrect permissions or a configuration issue. To resolve this, you can change the repository settings to allow write operations. Alternatively, you can create a new repository with the correct permissions and use that for snapshots. Also, ensure that the Elasticsearch user has the necessary permissions to write to the repository.

This guide will help you check for common problems that cause the log ” cannot snapshot shard on a readonly repository ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: snapshot, blobstore, shard, repositories, repository.

Log Context

Log “cannot snapshot shard on a readonly repository” class name is BlobStoreRepository.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 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();

 

How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?