Hi,
I had tried to perform a backup of elasticsearch on a server and restore on a different server by copying the backup folder and the steps are mentioned as below.
Index name: the_hive_15
Source OS: Ubuntu 18.04 - Elasticsearch version: 6.8.4
Destination OS: Redhat 8.6 - Elasticsearch version: 6.8.23
Elasticsearch data size: 21GB
ERROR
Index is in RED state and cannot be read by the application using Elasticsearch.
All shards failed
Steps
1. Creating backup repository
path.repo: ["/opt/hivebackup"]
2. Change the owner of the repo
sudo chown -R elasticsearch:elasticsearch /opt/backup
3. Registering the snapshot repository
curl -XPUT 'http://localhost:9200/_snapshot/the_hive_backup' -H 'Content-Type: application/json' -d '{
"type": "fs",
"settings": {
"location": "/opt/backup",
"compress": true,
}
}'
- RESPONSE
{"acknowledged":true}
4. Backing up the data
curl -XPUT 'http://localhost:9200/_snapshot/the_hive_backup/snapshot_1?wait_for_completion=true&pretty' -H 'Content-Type: application/json' -d '{
"indices": "the_hive_15"
}'
5. Registering the snapshot repository on the destination server
curl -XPUT 'http://localhost:9200/_snapshot/the_hive_backup?pretty' -H 'Content-Type: application/json' -d '{
"type": "fs",
"settings": {
"location": "/custom_location/hivebackup",
"compress": true,
}
}'
- RESPONSE
{"acknowledged":true}
7. Restoring the data on the destination server
curl -XPOST "http://localhost:9200/_snapshot/the_hive_backup/snapshot_1/_restore?pretty" -H 'Content-Type: application/json' -d '
{
"indices": "the_hive_15"
}'
- RESPONSE
{
"acknowledged" : true
}
On running the command curl -XGET "localhost:9200/_cat/indices?v"
, I get the health status of the index as 'red'.