Skip to main content

Maintenance

Backup Elasticsearch Data

  1. Snapshot Repository Configuration:
Open /etc/elasticsearch/elasticsearch.yml and configure a snapshot repository

path.repo: ["/path/to/backup"]

Replace /path/to/backup with the actual path where you want to store snapshots

  1. Restart Elasticsearch

After making changes, restart the Elasticsearch service

sudo systemctl restart elasticsearch
  1. Create Snapshot

Use the following command to create a snapshot

curl -X PUT "localhost:9200/_snapshot/my_backup" -H 'Content-Type: application/json' -d '{
"type": "fs",
"settings": {
"location": "/path/to/backup"
}
}'

Replace /path/to/backup with the actual path

Restore Elasticsearch Data Stop Elasticsearch

sudo systemctl stop elasticsearch
sudo systemctl stop elasticsearch
  1. Restore Snapshot

Use the following command to restore the snapshot

curl -X POST "localhost:9200/_snapshot/my_backup/snapshot_name/_restore"

Replace snapshot_name with the actual name of your snapshot

  1. Start Elasticsearch
sudo systemctl start elasticsearch