Use Snapshot Repositories to store backups of your Elasticsearch indices and clusters. Snapshots are important because they provide a copy of your data in case something goes wrong. If you need to roll back to an older version of your data, you can restore a snapshot from the repository.
Before using this feature, you should be familiar with how snapshots work. Snapshot and Restore is a good source for more detailed information.
To get started, go to Management > Elasticsearch > Snapshot Repositories. You begin with an overview of your repositories. You can then use the UI to drill down into your repositories and snapshots.
Registering a repositoryedit
You must have a registry before you can save your snapshots. If you don’t see a repository in the list, navigate to Register repository to create one.
Kibana supports three types of repositories on startup:
- Shared file system. Uses a shared file system to store the snapshots.
- Read-only url. Provides a read-only alternative to access snapshot data in another repository.
- Source-only. Enables storage of minimal, source-only snapshots. A source-only repository can take up to 50% less disk space.
A best practice is to register a repository for each major version of Elasticsearch. If you register the same snapshot repository with multiple clusters, give only one cluster write access to the repository. All other clusters connected to that repository should have read-only access.
Creating a snapshotedit
The snapshot process is "smart." Your first snapshot is a complete copy of data. All subsequent snapshots save the changes between the existing snapshots and the new data.
For an overview of the snapshots in your cluster, go to the Snapshots tab in Snapshot Repositories. You can then drill down into the details for each snapshot.
Example: Register a shared file system repositoryedit
This example shows how to register a shared file system repository and store snapshots.
Register the repository locationedit
You must register the location of the repository in the
path.repo setting on
your master and data nodes. You can do this in one of two ways:
elasticsearch.ymlto include the
path.reposetting when you start Elasticsearch.
bin/elasticsearch -E path.repo=/tmp/es-backups
Register the repositoryedit
Use Snapshot Repositories to register a repository.
- Go to Management > Elasticsearch > Snapshot Repositories.
- Click Register a repository.
Enter a name for your repository. For example,
Set Repository type to Shared file system.
- Click Next.
In Location, enter the path to the snapshot repository,
- In Chunk size, enter 100mb so that snapshot files are not bigger than that size.
- Use the defaults for all other fields.
Your new repository is listed on the Repositories tab.
Inspect the details for the repository.
The repository currently doesn’t have any snapshots.
Click Verify repository to view the repository connection status.
Add a snapshot to the repositoryedit
Use the snapshot API to create a snapshot.
- Go to Dev Tools > Console.
Create the snapshot.
In this example, the snapshot name is
2019-04-25_snapshot. You can also use date math expression for the snapshot name.
Open Snapshot Repositories.
Your new snapshot is available in the Snapshots tab.