... | ... | @@ -81,22 +81,27 @@ Prepare backup area (only needed the first time): |
|
|
}'
|
|
|
|
|
|
|
|
|
Take backup using:
|
|
|
Take snapshot:
|
|
|
|
|
|
sudo docker exec elasticsearch curl -XPUT 'localhost:9200/_snapshot/search_backup/snapshot_1?wait_for_completion=true'
|
|
|
|
|
|
Restore from backup using:
|
|
|
Import snapshot into to volume (if snappshot is from a different server)
|
|
|
|
|
|
# Import backup to volume
|
|
|
docker run --rm \
|
|
|
-v $(pwd):/from \
|
|
|
-v <dockernetwork>_elasticsearch_data:/to \
|
|
|
alpine ash -c "cd /to/backup ; tar -xf /from/esdata.tar"
|
|
|
# Close index for writes
|
|
|
|
|
|
Close index for writes
|
|
|
|
|
|
sudo docker exec elasticsearch curl -XPOST 'localhost:9200/search/_close'
|
|
|
# Restore:
|
|
|
|
|
|
Restore
|
|
|
|
|
|
sudo docker exec elasticsearch curl -XPOST 'localhost:9200/_snapshot/search_backup/snapshot_1/_restore'
|
|
|
# Open index for writes again
|
|
|
|
|
|
Open index for writes again
|
|
|
|
|
|
sudo docker exec elasticsearch curl -XPOST 'localhost:9200/search/_open'
|
|
|
|
|
|
When we are deploying upgrades that requires a full reindex (due to changes in the Elasticsearch document mappings), we perform the indexing on a staging server, and copy the data to our production server using the backup/restore commands displayed above.
|
... | ... | |