While we upgrade from old version(1.0) of Elastic search to latest version(4.0), we need to move the indexed data from old version back up to latest version's back up. So did the following
Faced the same exception told in this link. I checked the same command with sudo
. Yet it didn't worked out. So please tell how to reset the read/write settings / permission settings to allow the folder creation.
Query:
curl -XPUT http://xx.xx.xx.xx:9200/_snapshot/es_snap -d '{
"type": "fs",
"settings": {
"location": "/mount/backups/my_backup"
}
}'
Response:
{
"error":"RepositoryException[[es_snap] failed to create repository];
nested: CreationException[Guice creation errors:\n\n1) Error injecting constructor, org.elasticsearch.common.blobstore.BlobStoreException:
Failed to create directory at [
D:/data/es_snapshot_bkup/es_snapshot_repo
]\n
at org.elasticsearch.repositories.fs.FsRepository.<init>(Unknown Source)\n
while locating org.elasticsearch.repositories.fs.FsRepository\n
while locating org.elasticsearch.repositories.Repository\n\n1 error];
nested: BlobStoreException[Failed to create directory at [/mount/backups/my_backup]];",
"status":500
}
This is working for me. Please check it. Before Restore and Backup operation can be create a repository.
mkdir ~/backup
chmod 777 ~/backup
Create a repository (Repository is represent you path)
curl -XPUT http://xx.xx.xx.xx:9200/_snapshot/es_snap -d '{
"type": "fs",
"settings": {
"location": "/home/user/backup"
}
}
Snapshot
curl -XPUT "http://xx.xx.xx.xx:9200/_snapshot/es_snap/snapshot_1" -d '{
"indices": "index_1,index_2",
"ignore_unavailable": "true",
}'
Again Create a New Repository for Elastic search to latest version(4.0) and Mention the same location.
A snapshot can be restored using the following command:
curl -XPOST "http://xx.xx.xx.xx:9200/_snapshot/es_snap/snapshot_1/_restore"