↓ Skip to main content
Elastic

Snapshot & Restore

If you have a production grade elastic cluster it is always recommended to do a regular backup as a standard practice.

Snapshot is a backup of information, that can be be used to restore the last known good state of the system

In the context of elasticsearch you can take snapshot of an individual index or the whole cluster and it be either stored on local file system or on remote repositories like google cloud.

Snapshot and Restore
Snapshot and Restore

If you navigate to Snapshot and Restore in Kibana-Management you are presented the UI to execute the backup.

Kibana Snapshot and Restore page with Snapshots, Repositories, Policies and Restore Status tabs

Points to remember
#

  • Snapshots are incremental in nature, delta of data not available in the previous snapshot is only stored.
  • Can restore snapshots to running clusters.
  • Rest Restore - API interface can be used.
  • All indices restore is the default option.
  • Selective restore is also available.

Snapshot repository
#

A snapshot repository is required before, any snapshot can be taken.

It is always recommended to create a new snapshot for each major build version

Note: Snapshots written by one version may not be visible to the other and the repository could be corrupted.

Example
#

GET _snapshot

{

“repo_elastic7_5” : {

“type” : “source”,

“settings” : {

“compress” : “true”,

“delegate_type” : “fs”,

“location” : “/home/elasticsearch/backup”

}

}

}

In the example above you can see the GET request returns the Snapshot repo Name and information about the location.

Repository
Repository

The information that the Rest API showed can also be viewed from Kibana by clicking the repo-name.

Repository repo_elastic7_5: shared file system at /home/elasticsearch/backup with one snapshot found

Details
#

“type” : “fs”
#

FS is the shared file system to store the snapshots. The location is the exact location on system.

New Repo
#

Let’s try and add a new repo.

Kibana Register repository form with Shared file system selected
  • In step one you need to click the register the Repository button on the top left and the dialog as above should be displayed.
  • Specify a name and select the Shared File System and press next
Settings for the new repository: location /mnt/nfs/var/nfsshare/es with snapshot compression on
  • Add the location name - this location has to be present in the path.repo

In my example I have two paths set

ath.repo: ["/home/elasticsearch/backup","/mnt/nfs/var/nfsshare/es"]

In case you do not have the path set when you register it might fail like below

Error Cannot register new repository: the location doesn’t match any path in path.repo

Otherwise

Step 3
Step 3

– THE - END –

Author
Samarthya
Engineer, learner, tinkerer. This is my trophy shelf of everyday work and leisure.

Related

Elastic Cluster API

·1 min
Elastic Stack Monitoring Service is available with XPack only. GET _cluster/settings { “persistent” : { “xpack” : { “monitoring” : { “elasticsearch” : { “collection” : { “enabled” : “false” } }, “collection” : { “enabled” : “true” } } } }, “transient” : { } }

Metric Beat

All right, its been a busy week and finally some time at hand to write about something I have been doing. Mostly I am working on ELK stack these days, securing, validating, data analytics etc. Today, had the opportunity to go the Secure Elastic way, by enabling the TLS for secure communication within Nodes (Elastic cluster) and finally setup a Metric beat to get the status of the node.