Briefly, this error occurs when Elasticsearch encounters a snapshot repository that is in a format prior to version 5.0. This older format is incompatible with newer versions of Elasticsearch. To resolve this issue, you can either upgrade the repository to a newer format or delete and recreate it. Alternatively, you can restore the snapshot to an Elasticsearch cluster that supports the older format, then reindex the data into a newer version of Elasticsearch.
This guide will help you check for common problems that cause the log ” [{}] repository is on a pre-5.0 format with an index file that contains snapshot [{}] but ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: blobstore, repositories and repository-azure.
Overview
An Elasticsearch snapshot provides a backup mechanism that takes the current state and data in the cluster and saves it to a repository (read snapshot for more information). The backup process requires a repository to be created first. The repository needs to be registered using the _snapshot endpoint, and multiple repositories can be created per cluster. The following repository types are supported:
Repository types
Repository type | Configuration type |
---|---|
Shared file system | Type: “fs” |
S3 | Type : “s3” |
HDFS | Type :“hdfs” |
Azure | Type: “azure” |
Google Cloud Storage | Type : “gcs” |
Examples
To register an “fs” repository:
PUT _snapshot/my_repo_01 { "type": "fs", "settings": { "location": "/mnt/my_repo_dir" } }
Notes and good things to know
- S3, HDFS, Azure and Google Cloud require a relevant plugin to be installed before it can be used for a snapshot.
- The setting, path.repo: /mnt/my_repo_dir needs to be added to elasticsearch.yml on all the nodes if you are planning to use the repo type of file system. Otherwise, it will fail.
- When using remote repositories, the network bandwidth and repository storage throughput should be high enough to complete the snapshot operations normally, otherwise you will end up with partial snapshots.
Log Context
Log “[{}] repository is on a pre-5.0 format with an index file that contains snapshot [{}] but” classname is BlobStoreRepository.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :
for (final SnapshotId snapshotId : repositoryData.getSnapshotIds()) { final SnapshotInfo snapshotInfo; try { snapshotInfo = getSnapshotInfo(snapshotId); } catch (SnapshotException e) { logger.warn((Supplier>) () -> new ParameterizedMessage("[{}] repository is on a pre-5.0 format with an index file that contains snapshot [{}] but " + "the corresponding snap-{}.dat file cannot be read. The snapshot will no longer be included in " + "the repository but its data directories will remain."; getMetadata().name(); snapshotId; snapshotId.getUUID()); e); continue; } for (final String indexName : snapshotInfo.indices()) {