2019-06-07 20:28:01 +02:00
|
|
|
|
[role="xpack"]
|
|
|
|
|
[[snapshot-repositories]]
|
2019-07-12 20:29:57 +02:00
|
|
|
|
== Snapshot and Restore
|
2019-06-07 20:28:01 +02:00
|
|
|
|
|
2019-07-12 20:29:57 +02:00
|
|
|
|
*Snapshot and Restore* enables you to backup your {es}
|
|
|
|
|
indices and clusters using data and state snapshots.
|
|
|
|
|
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.
|
2019-06-07 20:28:01 +02:00
|
|
|
|
|
2019-07-12 20:29:57 +02:00
|
|
|
|
You’ll find *Snapshot and Restore* under *Management > Elasticsearch*.
|
|
|
|
|
With this UI, you can:
|
2019-06-07 20:28:01 +02:00
|
|
|
|
|
2019-07-18 18:12:43 +02:00
|
|
|
|
* <<kib-snapshot-register-repository, Register a repository for storing your snapshots>>
|
|
|
|
|
* <<kib-view-snapshot, View a list of your snapshots and drill down into details>>
|
|
|
|
|
* <<kib-restore-snapshot, Restore data into your cluster from a snapshot>>
|
|
|
|
|
* <<kib-delete-snapshot, Delete a snapshot to free storage space>>
|
2019-06-07 20:28:01 +02:00
|
|
|
|
|
|
|
|
|
[role="screenshot"]
|
2019-07-12 20:29:57 +02:00
|
|
|
|
image:management/snapshot-restore/images/snapshot_list.png["Snapshot list"]
|
|
|
|
|
|
|
|
|
|
Before using this feature, you should be familiar with how snapshots work.
|
|
|
|
|
{ref}/modules-snapshots.html[Snapshot and Restore] is a good source for
|
|
|
|
|
more detailed information.
|
2019-06-07 20:28:01 +02:00
|
|
|
|
|
|
|
|
|
[float]
|
2019-07-18 18:12:43 +02:00
|
|
|
|
[[kib-snapshot-register-repository]]
|
2019-07-12 20:29:57 +02:00
|
|
|
|
=== Register a repository
|
2019-06-07 20:28:01 +02:00
|
|
|
|
|
2019-07-12 20:29:57 +02:00
|
|
|
|
The *Repositories* view provides an overview of your repositories. You can
|
|
|
|
|
drill down into each repository for further investigation.
|
2019-06-07 20:28:01 +02:00
|
|
|
|
|
|
|
|
|
[role="screenshot"]
|
2019-07-12 20:29:57 +02:00
|
|
|
|
image:management/snapshot-restore/images/repository_list.png["Repository list"]
|
2019-06-07 20:28:01 +02:00
|
|
|
|
|
2019-07-12 20:29:57 +02:00
|
|
|
|
If you don't have a repository, you're prompted to register one. The
|
|
|
|
|
*Register repository* wizard supports three repository types
|
|
|
|
|
out of the box: shared file system, read-only URL, and source-only.
|
|
|
|
|
For details about these repositories and their settings,
|
2019-07-15 22:30:17 +02:00
|
|
|
|
see {ref}/modules-snapshots.html#snapshots-repositories[Repositories]. For an example,
|
2019-07-12 20:29:57 +02:00
|
|
|
|
see <<snapshot-repositories-example, registering a shared file system repository>>.
|
2019-06-07 20:28:01 +02:00
|
|
|
|
|
2019-07-12 20:29:57 +02:00
|
|
|
|
To use other repositories, such as S3, you can install plugins. See
|
2019-06-07 20:28:01 +02:00
|
|
|
|
{ref}/modules-snapshots.html#_repository_plugins[Repository plugins].
|
|
|
|
|
|
|
|
|
|
[float]
|
2019-07-18 18:12:43 +02:00
|
|
|
|
[[kib-view-snapshot]]
|
2019-07-12 20:29:57 +02:00
|
|
|
|
=== View your snapshots
|
|
|
|
|
|
|
|
|
|
The *Snapshots* view gives an overview of your snapshots. You can drill down
|
|
|
|
|
into each snapshot for further investigation.
|
|
|
|
|
|
|
|
|
|
[role="screenshot"]
|
|
|
|
|
image:management/snapshot-restore/images/snapshot_details.png["Snapshot details"]
|
2019-06-07 20:28:01 +02:00
|
|
|
|
|
2019-07-12 20:29:57 +02:00
|
|
|
|
To create snapshots, use the Kibana <<console-kibana, Console>>. The
|
2019-07-15 22:30:17 +02:00
|
|
|
|
{ref}//modules-snapshots.html#snapshots-take-snapshot[snapshot API]
|
2019-07-12 20:29:57 +02:00
|
|
|
|
takes the current state and data in your index or cluster, and then saves it to a
|
2019-06-07 20:28:01 +02:00
|
|
|
|
shared repository.
|
|
|
|
|
|
2019-07-12 20:29:57 +02:00
|
|
|
|
The snapshot process is "smart." Your first snapshot is a complete copy of
|
|
|
|
|
the data in your index or cluster.
|
2019-06-07 20:28:01 +02:00
|
|
|
|
All subsequent snapshots save the changes between the existing snapshots and
|
|
|
|
|
the new data.
|
|
|
|
|
|
2019-07-12 20:29:57 +02:00
|
|
|
|
[float]
|
2019-07-18 18:12:43 +02:00
|
|
|
|
[[kib-restore-snapshot]]
|
2019-07-12 20:29:57 +02:00
|
|
|
|
=== Restore a snapshot
|
|
|
|
|
|
|
|
|
|
The *Restore* wizard walks you through the process of restoring a snapshot
|
|
|
|
|
into a running cluster. To get started, go to the *Snapshots* view, find the
|
|
|
|
|
snapshot, and click the restore icon in the *Actions* column. You’re presented
|
|
|
|
|
options for defining the restore, including which
|
|
|
|
|
indices to restore and whether to modify the index settings.
|
|
|
|
|
|
|
|
|
|
To track the progress of a restore, use the *Restore Status* view. You’ll
|
|
|
|
|
see the current state for each shard in the snapshot.
|
2019-06-07 20:28:01 +02:00
|
|
|
|
|
|
|
|
|
[role="screenshot"]
|
2019-07-12 20:29:57 +02:00
|
|
|
|
image:management/snapshot-restore/images/restore-status.png["Snapshot details"]
|
|
|
|
|
|
|
|
|
|
[float]
|
2019-07-18 18:12:43 +02:00
|
|
|
|
[[kib-delete-snapshot]]
|
2019-07-12 20:29:57 +02:00
|
|
|
|
=== Delete a snapshot
|
|
|
|
|
|
|
|
|
|
Delete snapshots to manage your repository storage space.
|
|
|
|
|
Find the snapshot in the *Snapshots* view and click the trash icon in the
|
|
|
|
|
*Actions* column. To delete snapshots in bulk, select their checkboxes,
|
|
|
|
|
and then click *Delete snapshots*.
|
2019-06-07 20:28:01 +02:00
|
|
|
|
|
2019-07-12 20:29:57 +02:00
|
|
|
|
[[snapshot-repositories-example]]
|
2019-06-07 20:28:01 +02:00
|
|
|
|
[float]
|
|
|
|
|
=== Example: Register a shared file system repository
|
|
|
|
|
|
|
|
|
|
This example shows how to register a shared file system repository
|
|
|
|
|
and store snapshots.
|
|
|
|
|
|
|
|
|
|
[float]
|
|
|
|
|
==== Register the repository location
|
|
|
|
|
|
|
|
|
|
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`
|
|
|
|
|
|
|
|
|
|
[float]
|
|
|
|
|
==== Register the repository
|
|
|
|
|
|
2019-07-12 20:29:57 +02:00
|
|
|
|
Use *Snapshot and Restore* to register the repository where your snapshots
|
|
|
|
|
will live.
|
2019-06-07 20:28:01 +02:00
|
|
|
|
|
2019-07-12 20:29:57 +02:00
|
|
|
|
. Go to *Management > Elasticsearch > Snapshot and Restore*.
|
|
|
|
|
. Open the *Repositories* view.
|
2019-06-07 20:28:01 +02:00
|
|
|
|
. Click *Register a repository*.
|
|
|
|
|
. Enter a name for your repository. For example, `my_backup`.
|
|
|
|
|
. Set *Repository type* to Shared file system.
|
|
|
|
|
+
|
|
|
|
|
[role="screenshot"]
|
|
|
|
|
image:management/snapshot-restore/images/register_repo.png["Register repository"]
|
|
|
|
|
|
|
|
|
|
. 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.
|
|
|
|
|
+
|
2019-07-12 20:29:57 +02:00
|
|
|
|
. Click the respository and inspect its details.
|
2019-06-07 20:28:01 +02:00
|
|
|
|
+
|
|
|
|
|
The repository currently doesn’t have any snapshots.
|
2019-07-12 20:29:57 +02:00
|
|
|
|
|
2019-06-07 20:28:01 +02:00
|
|
|
|
|
|
|
|
|
[float]
|
|
|
|
|
==== Add a snapshot to the repository
|
2019-07-15 22:30:17 +02:00
|
|
|
|
Use the {ref}//modules-snapshots.html#snapshots-take-snapshot[snapshot API] to create a snapshot.
|
2019-06-07 20:28:01 +02:00
|
|
|
|
|
|
|
|
|
. Go to *Dev Tools > Console*.
|
|
|
|
|
. Create the snapshot.
|
|
|
|
|
+
|
|
|
|
|
In this example, the snapshot name is `2019-04-25_snapshot`. You can also
|
|
|
|
|
use {ref}//date-math-index-names.html[date math expression] for the snapshot name.
|
|
|
|
|
+
|
|
|
|
|
[role="screenshot"]
|
|
|
|
|
image:management/snapshot-restore/images/create_snapshot.png["Create snapshot"]
|
|
|
|
|
+
|
2019-07-12 20:29:57 +02:00
|
|
|
|
. Open *Snapshot and Restore*.
|
2019-06-07 20:28:01 +02:00
|
|
|
|
+
|
2019-07-12 20:29:57 +02:00
|
|
|
|
Your new snapshot is available in the *Snapshots* view.
|
2019-06-07 20:28:01 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|