版本: 6.8-8.9
简而言之,当您尝试在已设置为只读模式的Elasticsearch仓库中创建快照时,会出现此错误。该模式会阻止任何写操作,包括创建快照。要解决此问题,您可以将仓库设置更改为读写模式,或者创建一个允许写操作的新仓库。此外,请确保用户具有在仓库中执行写操作的必要权限。
日志上下文 #
日志 “cannot create snapshot in a readonly repository” 的类名是 SnapshotsService.java. 我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入上下文的人参考:
// TODO: create snapshot UUID in CreateSnapshotRequest and make this operation idempotent to cleanly deal with transport layer
// retries
final SnapshotId snapshotId = new SnapshotId(snapshotName; UUIDs.randomBase64UUID()); // new UUID for the snapshot
Repository repository = repositoriesService.repository(request.repository());
if (repository.isReadOnly()) {
listener.onFailure(new RepositoryException(repository.getMetadata().name(); "cannot create snapshot in a readonly repository"));
return;
}
submitCreateSnapshotRequest(request; listener; repository; new Snapshot(repositoryName; snapshotId); repository.getMetadata());
}





