Elastic Search Data Backup

Find all the steps for data backup for Elasticsearch


 Prerequisite
  • Software: Elastic Search
  • OS: Linux
 Steps For Setup

Step 1:

  • Create and give all access to backup folder
    1. cd /etc/elasticsearch
    2. mkdir ElasticSearch_backup
    3. chmod 777 ElasticSearch_backup

Step 2:

  • Update elasticsearch.yml in this path /etc/elasticsearch
  1. Uncomment and change path.repo: /etc/elasticsearch/ElasticSearch_backup

Step 3:

  • Stop and Start the Elastic Search

Step 4: 

  • Execute the below curl command to take backup location
In this curl Example it will create like /etc/elasticsearch/ElasticSearch_backup/indexdata

  curl -XPUT 'http://localhost:9200/_snapshot/es_backup' -d '{
"type": "fs",
"settings": {
"location": "indexdata",
"compress": true
}
}' 

Step 5: 

  • Once done with the above steps. We can run cron script mentioned below as Index backup script
Cron Script

 #!/bin/bash
 backup=`date +%Y%m%d-%H%M%S`
 curl -XPUT "http://localhost:9200/_snapshot/es_backup/$backup?wait_for_completion=true" -d '{
 "indices":"neo4j-index-node",
 "ignore_unavilable":true,
 "include_global_state":false
 }'

©2021 Cognizant, all rights reserved. US Patent 10,410,152