Question

Answers

  • 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

preview thumbnail
Introduction to Kibana

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

preview thumbnail
Bucket Aggregation in Elasticsearch

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

preview thumbnail
Metrics Aggregations in Elasticsearch

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

preview thumbnail
Introduction to Elasticsearch Aggregations

Aug 14, 2018, 4:47:56 PM | Anurag Srivastava

preview thumbnail
Wildcard and Boolean Search in Elasticsearch

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

preview thumbnail
Basics of Data Search in Elasticsearch

Aug 4, 2018, 7:02:21 AM | Anurag Srivastava

Top Blogs

preview thumbnail
Wildcard and Boolean Search in Elasticsearch

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

preview thumbnail
Elasticsearch REST APIs

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

preview thumbnail
preview thumbnail
Create a Chess board in PHP

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

preview thumbnail
Bucket Aggregation in Elasticsearch

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

preview thumbnail
Metrics Aggregations in Elasticsearch

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