• user image
    Anurag Srivastava
    Oct 11, 2020, 8:56:22 AM |

    We can create the backup of Elasticsearch Cluster using the following steps:

    • We first need to identify the directory location where we want to store the snapshot files. Let's say I want to store it in "/var/tmp/backups" directory.

    • We need to provide the directory access to Elasticsearch user so that Elasticsearch can write the snapshot files.
    chown -R elasticsearch. /var/tmp/backups

    • Now we need to tell Elasticsearch that this is our snapshot directory location. For that, we need to add the "repo.path" setting in the elasticsearch.yml file.
    path.repo: ["/var/tmp/backups"]

    • Here we are using the local file system directory for storing the snapshot but the same can be stored on the cloud as well. But in this blog, we will focus on file system based snapshots only.
    • We first need to create the repository which would be used for taking a snapshot and to restore. We can create the repository using the following expression:
    PUT _snapshot/anurag_backup
     "type": "fs",
     "settings": {
       "location": "/var/tmp/backups"

    • After creating the repository we can take the snapshot of all indices using the following expression:
    PUT _snapshot/anurag_backup/snapshot_all_indices

    • If we want to take a snapshot of one or more index only then we can specify the index name in a comma-separated form, please refer to the below expression:
    PUT _snapshot/anurag_backup/snapshot_some_indices
     "indices": "index1, index2"

    • If we want to see the snapshot details then we need to run the following expression:
    GET _snapshot/anurag_backup/snapshot_all_indices 

    The above expression provides us the snapshot details like version, list of indices, start time, end time, duration in milis, etc. If you want to learn more then please refer to my blog: "Snapshot and Restore Elasticsearch Indices"

    1 | 0

Related Blogs

Create Sequence Diagrams using PlantUML

Jun 27, 2021, 12:50:31 PM | Anurag Srivastava

Improving your productivity on Linux Terminal

Nov 29, 2020, 5:16:40 PM | Anurag Srivastava

Elastic Stack Interview Questions

Sep 12, 2020, 3:58:55 PM | Anurag Srivastava

Introduction to Kibana

Aug 1, 2020, 6:19:45 PM | Anurag Srivastava

Create a Chess board in PHP

Mar 9, 2020, 8:45:41 AM | Rocky Paul

Handling Excel file using Python (Part 2)

Dec 31, 2019, 1:33:53 PM | Anurag Srivastava

Top Blogs

Wildcard and Boolean Search in Elasticsearch

Aug 10, 2018, 7:14:40 PM | Anurag Srivastava

Elasticsearch REST APIs

Jul 31, 2018, 6:16:42 PM | Anurag Srivastava

Create a Chess board in PHP

Mar 9, 2020, 8:45:41 AM | Rocky Paul

Bucket Aggregation in Elasticsearch

Aug 29, 2018, 7:15:06 PM | Anurag Srivastava

Metrics Aggregations in Elasticsearch

Aug 18, 2018, 6:02:20 PM | Anurag Srivastava