Managing repositories
ElasticSearch provides a built-in system to quickly snapshot and restore your data. When working with live data, it's difficult to have a backup because of the large number of concurrency problems.
An ElasticSearch snapshot allows us to create snapshots of individual indices (or aliases), or an entire cluster, in a remote repository.
Before starting to execute a snapshot, a repository must be created.
Getting ready
You need a working ElasticSearch cluster.
How to do it...
To manage a repository, we will perform the following steps:
- To create a repository called
my_backup
, the HTTP method isPUT
and the curl command is:curl -XPUT 'http://localhost:9200/_snapshot/my_backup' -d '{ "type": "fs", "settings": { "location": "/tmp/my_backup", "compress": true } }'
The result will be:
{"acknowledged":true}
If you check on your filesystem, the directory
/tmp/my_backup
is created...