<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Shivesh Yadav</title>
    <description>The latest articles on DEV Community by Shivesh Yadav (@shiveshsky).</description>
    <link>https://dev.to/shiveshsky</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F170257%2Faa2c407c-f590-455c-8bd4-307b938523c4.png</url>
      <title>DEV Community: Shivesh Yadav</title>
      <link>https://dev.to/shiveshsky</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shiveshsky"/>
    <language>en</language>
    <item>
      <title>Snapshot/Restore Elasticsearch using Curator</title>
      <dc:creator>Shivesh Yadav</dc:creator>
      <pubDate>Thu, 21 Nov 2019 04:54:42 +0000</pubDate>
      <link>https://dev.to/shiveshsky/snapshot-restore-elasticsearch-using-curator-4ln</link>
      <guid>https://dev.to/shiveshsky/snapshot-restore-elasticsearch-using-curator-4ln</guid>
      <description>&lt;p&gt;Well, first things first you will need Elasticsearch curator installed on your system.&lt;br&gt;
I prefer installing it using pip as its easy peezy lemon squeezy. Just do&lt;br&gt;
pip install elasticsearch-curator&lt;br&gt;
There are other insane ways of installing it like using apt you can go to apt curator install instructions and follow the instructions there.&lt;br&gt;
Now, the easy part. Follow along with the steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a snapshot directory.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;mkdir -p /elasticsearchData/es-backup&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now, we need to give elasticsearch permissions to write to this directory. Provided the user running elasticsearch service is elasticsearch.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;chown -R elasticsearch:elasticsearch /elasticsearchData/es-backup&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now we will give this backup path to elasticsearch by making an entry to the elasticsearch.yml
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;nano /etc/elasticsearch/elasticsearch.yml&lt;br&gt;
and add&lt;br&gt;
path.repo: ["/elasticseacrhData/es-backup"]&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Next, we need to restart elasticsearch server. If you are on Ubuntu/Debian fire the below command.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;sudo systemctl restart elasticsearch&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now we will add the created repository on to elasticsearch.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;curl -XPUT -H "Content-Type: application/json;charset=UTF-8" 'http://localhost:9200/_snapshot/esbackup' -d '{&lt;br&gt;
 "type": "fs",&lt;br&gt;
 "settings": {&lt;br&gt;
 "location": "/elasticsearchData/es-backup",&lt;br&gt;
 "compress": true&lt;br&gt;
 }&lt;br&gt;
}'&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;where esbackup is the name of the repository where ES data will be backed up.&lt;br&gt;
You should get this&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;{"acknowledge": true}&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
 response.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Now, we can take backup by firing a curl command. But here we will use Elasticsearch Curator for backup and restore.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You can get the yml files for curator here.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Required yml file for curatorTo take backup go to the scripts folder and run&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;/path/where/curator/is/installed/envs/envname_py3/bin/curator ./action_snapshot.yml - config ./curator_conf.yml&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;To restore from the backup go to the scripts folder and run.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;/path/where/curator/is/installed/envs/envname_py3/bin/curator ./action_restore.yml - config ./curator_conf.yml&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Voila, you will see your backup RESTORED.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
