- sudo bin/elasticsearch-plugin install repository-s3 (or setup from config / yaml file if docker)
- run elastic-search (
./bin/elastic
)
- Create s3 bucket
- Create IAM role with access to the s3 bucket and copy his access & secret keys
- Add your credentials to elastic search configuration or via config/ elastic-search.yaml file
bin/elasticsearch-keystore add s3.client.default.access_key
bin/elasticsearch-keystore add s3.client.default.secret_key
- Create a Snapshot repository
PUT localhost:9200/_snapshot/<repo-name>
{
"type": "s3",
"settings": {
"bucket": "<bucket-name>",
"region": "<aws-region>",
// "access_key": "AWS_ACCESS_KEY",
// "secret_key": "AWS_SECRET_KEY",
"compress": true
}
}
- Create Snapshot in that repository
PUT localhost:9200/_snapshot/<repo-name>/<snapshot-name>
- Restore a snapshot
POST localhost:9200/_snapshot/<repo-name>/<snapshot-name>/_restore
- Configure the local repo path from elastic-search.yml file by adding
path.repo: ["<your backup dir name>"]
- Create a fs snapshot repository
PUT http://localhost:9200/_snapshot/<repo-name>
{
"type": "fs",
"settings": {
"location": "my_backup_location"
}
}
- Move existing backup content to that directory. (The directory name =
{one you created from step1}/{location from step2}
) or download backup content from s3 via aws-cli aws s3 sync s3://<Bucket-Name> <Local-Dir-Name>/
- List all snapshots in the repository
GET /_snapshot/localbackup/_all
- Restore a snapshot
POST localhost:9200/_snapshot/<repo-name>/<snapshot-name>/_restore