Snapshot repositories

edit

Snapshot repositories

edit

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.

Repository list

Registering a repository

edit

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.

Register repository

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

edit

Use 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.

Snapshot details

Example: Register a shared file system repository

edit

This example shows how to register a shared file system repository and store snapshots.

Register the repository location

edit

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:

  • Edit your elasticsearch.yml to include the path.repo setting.
  • Pass the path.repo setting when you start Elasticsearch.

    bin/elasticsearch -E path.repo=/tmp/es-backups

Register the repository

edit

Use Snapshot Repositories to register a repository.

  1. Go to Management > Elasticsearch > Snapshot Repositories.
  2. Click Register a repository.
  3. Enter a name for your repository. For example, my_backup.
  4. Set Repository type to Shared file system.

    Register repository

  5. Click Next.
  6. In Location, enter the path to the snapshot repository, /tmp/es-backups.
  7. In Chunk size, enter 100mb so that snapshot files are not bigger than that size.
  8. Use the defaults for all other fields.
  9. Click Register.

    Your new repository is listed on the Repositories tab.

  10. Inspect the details for the repository.

    The repository currently doesn’t have any snapshots.

  11. Click Verify repository to view the repository connection status.

    Verify repository

Add a snapshot to the repository

edit

Use the snapshot API to create a snapshot.

  1. Go to Dev Tools > Console.
  2. 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.

    Create snapshot

  3. Open Snapshot Repositories.

    Your new snapshot is available in the Snapshots tab.