How to Backup and Restore with Elasticsearch

The snapshot and restore module allows to create snapshots of individual indices or an entire cluster into a remote repository like shared file system, S3, or HDFS.

The full detailed documentation is here.

Requirements

Check if the config files have « path.repo »:

$ nano /etc/elasticsearch/elasticsearch.yml

 SNAPSHOT

Create snapshot with this command:

PUT /_snapshot/backup
{
  "type": "fs",
  "settings": {
      "compress": true,
      "location": "/usr/share/elasticsearch/backup"
  }
}

This command show snapshot path:

GET /_snaptshot/

BACKUP

 Initiate the backup with this command based on the snapshot:

PUT /_snapshot/backup/snapshot_1
{
  "indices": "recipes",
  "ignore_unavailable": true,
  "include_global_state": false
}

To show the status of the snapshot:

 GET /_snapshot/backup/snapshot_1

The files created:

RESTORE

Create also the same snapshot path:

Execute this type of command to restore:

 POST /_snapshot/my_backup/snapshot_1/_restore

DELETE

How to delete a snaptshot:

$ delete /_snapshot/backup/snapshot_1

One thought on “How to Backup and Restore with Elasticsearch

  1. James H Jr Chaney Reply

    I’ve been browsing online greater than three hours these days, yet I
    never discovered any attention-grabbing article like yours.
    It’s pretty price sufficient for me. Personally, if all
    site owners and bloggers made excellent content material as you did,
    the net might be a lot more helpful than ever before.

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *