{"id":454,"date":"2020-02-26T08:58:21","date_gmt":"2020-02-26T08:58:21","guid":{"rendered":"https:\/\/www.samarthya.me\/wps\/?p=454"},"modified":"2020-02-26T10:07:34","modified_gmt":"2020-02-26T10:07:34","slug":"snapshot-restore","status":"publish","type":"post","link":"https:\/\/blog.samarthya.me\/wps\/2020\/02\/26\/snapshot-restore\/","title":{"rendered":"Snapshot &#038; Restore"},"content":{"rendered":"\n<p>If you have a production grade elastic cluster it is always recommended to do a regular backup as a standard practice.<\/p>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<blockquote class=\"wp-block-quote is-style-default is-layout-flow wp-block-quote-is-layout-flow\"><p>Snapshot is a backup of information, that can be be used to restore the last known good state of the system<\/p><\/blockquote>\n\n\n\n<p>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.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"223\" height=\"288\" src=\"https:\/\/www.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-1.03.51-PM.png\" alt=\"\" class=\"wp-image-455\"\/><figcaption>Snapshot and Restore<\/figcaption><\/figure><\/div>\n\n\n\n<p>If you navigate to Snapshot and Restore in Kibana-Management you are presented the UI to execute the backup.<\/p>\n\n\n\n<figure class=\"wp-block-gallery columns-1 is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img decoding=\"async\" width=\"1024\" height=\"237\" src=\"https:\/\/www.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-1.05.31-PM-1024x237.png\" alt=\"\" data-id=\"456\" data-full-url=\"https:\/\/www.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-1.05.31-PM.png\" data-link=\"https:\/\/www.samarthya.me\/wps\/?attachment_id=456\" class=\"wp-image-456\" srcset=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-1.05.31-PM-1024x237.png 1024w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-1.05.31-PM-300x69.png 300w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-1.05.31-PM-768x178.png 768w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-1.05.31-PM-850x197.png 850w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-1.05.31-PM.png 1180w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/li><\/ul><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Points to remember<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Snapshots are incremental in nature, delta of data not available in the previous snapshot is only stored.<\/li><li>Can restore snapshots to running clusters.<\/li><li>Rest <a href=\"https:\/\/www.elastic.co\/guide\/en\/elasticsearch\/reference\/7.5\/snapshots-restore-snapshot.html\">Restore<\/a> &#8211; API interface can be used.<\/li><li>All indices restore is the default option.<\/li><li>Selective restore is also available.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Snapshot repository<\/h2>\n\n\n\n<p>A snapshot repository is required before, any snapshot can be taken. <\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-style-default is-layout-flow wp-block-quote-is-layout-flow\"><p>It is always recommended to create a new snapshot for each major build version<\/p><\/blockquote>\n\n\n\n<pre class=\"wp-block-verse\"><strong>Note:<\/strong> Snapshots written by one version may not be visible to the other and the repository could be corrupted.<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Example<\/h3>\n\n\n\n<pre class=\"wp-block-verse\">GET _snapshot<\/pre>\n\n\n\n<pre class=\"wp-block-verse\">{<br>\n  \"repo_elastic7_5\" : {<br>\n    \"type\" : \"source\",<br>\n    \"settings\" : {<br>\n      \"compress\" : \"true\",<br>\n      \"delegate_type\" : \"fs\",<br>\n      \"location\" : \"\/home\/elasticsearch\/backup\"<br>\n    }<br>\n  }<br>\n}<\/pre>\n\n\n\n<p>In the example above you can see the GET request returns the Snapshot repo Name and information about the location.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"321\" src=\"https:\/\/www.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-2.06.47-PM-1024x321.png\" alt=\"\" class=\"wp-image-457\" srcset=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-2.06.47-PM-1024x321.png 1024w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-2.06.47-PM-300x94.png 300w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-2.06.47-PM-768x241.png 768w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-2.06.47-PM-850x266.png 850w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-2.06.47-PM.png 1177w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption>Repository<\/figcaption><\/figure>\n\n\n\n<p>The information that the Rest API showed can also be viewed from Kibana by clicking the repo-name.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"518\" height=\"938\" src=\"https:\/\/www.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-2.25.26-PM.png\" alt=\"\" class=\"wp-image-460\" srcset=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-2.25.26-PM.png 518w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-2.25.26-PM-166x300.png 166w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-2.25.26-PM-300x543.png 300w\" sizes=\"(max-width: 518px) 100vw, 518px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Details<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">&#8220;type&#8221; : &#8220;fs&#8221;<\/h4>\n\n\n\n<p>FS is the shared file system to store the snapshots. The location is the exact location on system.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">New Repo<\/h2>\n\n\n\n<p>Let&#8217;s try and add a new repo.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"578\" src=\"https:\/\/www.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-3.25.16-PM-1024x578.png\" alt=\"\" class=\"wp-image-462\" srcset=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-3.25.16-PM-1024x578.png 1024w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-3.25.16-PM-300x169.png 300w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-3.25.16-PM-768x434.png 768w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-3.25.16-PM-850x480.png 850w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-3.25.16-PM.png 1149w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>In step one you need to click the register the Repository button on the top left and the dialog as above should be displayed.<\/li><li>Specify a name and select the <code>Shared File System<\/code> and press next<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-gallery aligncenter columns-1 is-cropped wp-block-gallery-2 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"734\" src=\"https:\/\/www.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-3.26.01-PM-1024x734.png\" alt=\"\" data-id=\"463\" data-full-url=\"https:\/\/www.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-3.26.01-PM.png\" data-link=\"https:\/\/www.samarthya.me\/wps\/2020\/02\/26\/snapshot-restore\/screenshot-2020-02-26-at-3-26-01-pm\/\" class=\"wp-image-463\" srcset=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-3.26.01-PM-1024x734.png 1024w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-3.26.01-PM-300x215.png 300w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-3.26.01-PM-768x551.png 768w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-3.26.01-PM-850x610.png 850w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-3.26.01-PM.png 1167w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/li><\/ul><figcaption class=\"blocks-gallery-caption\">Step 2<\/figcaption><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Add the location name &#8211; this location has to be present in the <code>path.repo<\/code> <\/li><\/ul>\n\n\n\n<p>In my example I have two paths set<\/p>\n\n\n\n<pre class=\"wp-block-verse\">ath.repo: [\"\/home\/elasticsearch\/backup\",\"\/mnt\/nfs\/var\/nfsshare\/es\"]<\/pre>\n\n\n\n<p>In case you do not have the path set when you register it might fail like below<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"248\" src=\"https:\/\/www.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-3.26.14-PM-1024x248.png\" alt=\"\" class=\"wp-image-464\" srcset=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-3.26.14-PM-1024x248.png 1024w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-3.26.14-PM-300x73.png 300w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-3.26.14-PM-768x186.png 768w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-3.26.14-PM-850x206.png 850w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-3.26.14-PM.png 1208w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Otherwise<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"682\" src=\"https:\/\/www.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-3.29.56-PM-1024x682.png\" alt=\"\" class=\"wp-image-465\" srcset=\"https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-3.29.56-PM-1024x682.png 1024w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-3.29.56-PM-300x200.png 300w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-3.29.56-PM-768x512.png 768w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-3.29.56-PM-850x566.png 850w, https:\/\/blog.samarthya.me\/wps\/wp-content\/uploads\/2020\/02\/Screenshot-2020-02-26-at-3.29.56-PM.png 1412w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption>Step 3<\/figcaption><\/figure>\n<\/div><\/div>\n\n\n\n<p class=\"has-text-align-center\">&#8212; THE &#8211; END &#8212;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":458,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[34],"tags":[56,32,58,57],"class_list":["post-454","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technical","tag-devops","tag-elastic","tag-restore","tag-snapshot"],"_links":{"self":[{"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/posts\/454","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/comments?post=454"}],"version-history":[{"count":0,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/posts\/454\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/media\/458"}],"wp:attachment":[{"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/media?parent=454"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/categories?post=454"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/tags?post=454"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}