Snapshot repositories
editSnapshot repositories
editUse 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 repository
editYou 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.
For more information on these repositories and the settings that you can configure, see Repositories. To add support for additional types, see Repository plugins.
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 snapshot
editUse the Kibana Console to create your snapshots. The snapshot API takes the current state and data in your index or cluster and saves it to a shared repository.
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 repository
editThis example shows how to register a shared file system repository and store snapshots.
Register the repository location
editYou 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:
-
Edit your
elasticsearch.yml
to include thepath.repo
setting. -
Pass the
path.repo
setting when you start Elasticsearch.bin/elasticsearch -E path.repo=/tmp/es-backups
Register the repository
editUse Snapshot Repositories to register a repository.
- Go to Management > Elasticsearch > Snapshot Repositories.
- Click Register a repository.
-
Enter a name for your repository. For example,
my_backup
. -
Set Repository type to Shared file system.
- Click Next.
-
In Location, enter the path to the snapshot repository,
/tmp/es-backups
. - In Chunk size, enter 100mb so that snapshot files are not bigger than that size.
- Use the defaults for all other fields.
-
Click Register.
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 repository
editUse 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.