A Docker container to restore Elasticsearch snapshots.
$BACKUP_REPOSITORY_NAME
- Name of the repository, where the snapshot is present. Refer to the repositories section of the official elasticsearch docs.SNAPSHOT_NAME
- Name of the snapshot, from which the recovery is to be initiated.ELASTICSEARCH_HOST
- Host name of the machine running ElasticsearchELASTICSEARCH_PORT
- Port number where Elasticsearch is runningDEBUG
- If true will give you the value of all variables in terminal. default to false
Special Note: No defaults are assumed. The script will return error if the required Environment variables are not passed.
On running this container,
- A es restore HTTP request is made in accordance to the elasticsearch documentation, using the provided
_BACKUP_REPOSITORY_NAME_
and_SNAPSHOT_NAME_
, for the given_ELASTICSEARCH_HOST_
,_ELASTICSEARCH_PORT_
values.
NOTE: If the Elasticsearch server is also a docker image, make sure that you use the --network=<network_name>
option while running the docker command.
docker run --rm --name es-restore [--network=XXX] \
-e "BACKUP_REPOSITORY_NAME=backup" \
-e "SNAPSHOT_NAME=snapshot_2" \
-e "ELASTICSEARCH_HOST=es-server" \
-e "ELASTICSEARCH_PORT=9200" \
-e "DEBUG=true" \
gvatreya/docker-elasticsearch-restore-azure
[DEBUG] BACKUP_REPOSITORY_NAME = backup
[DEBUG] SNAPSHOT_NAME = snapshot_2
[DEBUG] ELASTICSEARCH_HOST = es-server
[DEBUG] ELASTICSEARCH_PORT = 9200
[INFO] Closing all indices to proceed with the restore.
[DEBUG] Result: {"acknowledged":true}
[INFO] Initializing Snapshot recovery.
[DEBUG] Result: {"snapshot":{"snapshot":"snapshot_2","indices":["twitter"],"shards":{"total":5,"failed":0,"successful":5}}}
[INFO] Successfully recovered from snapshot. Exiting now
docker run --rm --name es-restore [--network=XXX] \
-e "BACKUP_REPOSITORY_NAME=backup" \
-e "SNAPSHOT_NAME=snapshot_2" \
-e "ELASTICSEARCH_HOST=es-server" \
-e "ELASTICSEARCH_PORT=9200" \
-e "DEBUG=false" \
gvatreya/docker-elasticsearch-restore-azure
[INFO] Debug not enabled. To enable, set DEBUG=true
[INFO] Closing all indices to proceed with the restore.
[INFO] Initializing Snapshot recovery.
[INFO] Successfully recovered from snapshot. Exiting now
docker run --rm --name es-restore [--network=XXX] \
-e "BACKUP_REPOSITORY_NAME=backup" \
-e "SNAPSHOT_NAME=snapshot_2" \
-e "ELASTICSEARCH_HOST=NON-EXISTING-HOST" \
-e "ELASTICSEARCH_PORT=9200" \
-e "DEBUG=true" \
gvatreya/docker-elasticsearch-restore-azure
[DEBUG] BACKUP_REPOSITORY_NAME = backup
[DEBUG] SNAPSHOT_NAME = snapshot_2
[DEBUG] ELASTICSEARCH_HOST = NON-EXISTING-HOST
[DEBUG] ELASTICSEARCH_PORT = 9200
[ERROR] Are you sure the supplied elasticsearch host and/or port (NON-EXISTING-HOST,9200) is correct ?
docker run --rm --name es-restore [--network=XXX] \
-e "BACKUP_REPOSITORY_NAME=backup" \
-e "SNAPSHOT_NAME=INVALID_NAME" \
-e "ELASTICSEARCH_HOST=es-server" \
-e "ELASTICSEARCH_PORT=9200" \
-e "DEBUG=true" \
gvatreya/docker-elasticsearch-restore-azure
[DEBUG] BACKUP_REPOSITORY_NAME = backup
[DEBUG] SNAPSHOT_NAME = INVALID_NAME
[DEBUG] ELASTICSEARCH_HOST = es-server
[DEBUG] ELASTICSEARCH_PORT = 9200
[INFO] Closing all indices to proceed with the restore.
[DEBUG] Result: {"acknowledged":true}
[INFO] Initializing Snapshot recovery.
[DEBUG] Result: {"error":{"root_cause":[{"type":"snapshot_restore_exception","reason":"[backup:INVALID_NAME] snapshot does not exist"}],"type":"snapshot_restore_exception","reason":"[backup:INVALID_NAME] snapshot does not exist"},"status":500}
[ERROR] Error occurred while recovering from snapshot. Exiting now
docker build -t gvatreya/docker-elasticsearch-restore-azure .