当我们从 Elasticsearch 的旧版本(1.0)升级到最新版本(4.0)时,我们需要将索引数据从旧版本备份到最新版本的备份。以下也是如此
- 在 elasticsearch windows 机器上拍下数据快照
- 在elasticsearch ubuntu机器中恢复(注册)快照数据
遇到与此 link 中相同的异常.我用 sudo
检查了相同的命令。然而并没有成功。因此,请告知如何重置读/写设置/权限设置以允许创建文件夹。
查询:
curl -XPUT http://xx.xx.xx.xx:9200/_snapshot/es_snap -d '{
"type": "fs",
"settings": {
"location": "/mount/backups/my_backup"
}
}'
响应:
{
"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
}
最佳答案
这对我有用。请检查一下。 在恢复和备份操作之前可以创建一个存储库。
mkdir ~/backup
chmod 777 ~/备份
创建一个存储库(存储库代表你的路径)
curl -XPUT http://xx.xx.xx.xx:9200/_snapshot/es_snap -d '{ “类型”:“FS”, “设置”:{ “位置”:“/家/用户/备份” } }
快照
curl -XPUT "http://xx.xx.xx.xx:9200/_snapshot/es_snap/snapshot_1"-d '{ “指数”:“index_1,index_2”, "ignore_unavailable": "真", }'
再次为最新版本 (4.0) 的 Elastic search 创建一个新的存储库,并提及相同的位置。
可以使用以下命令恢复快照:
curl -XPOST "http://xx.xx.xx.xx:9200/_snapshot/es_snap/snapshot_1/_restore"
关于ubuntu - 在 ubuntu 机器中恢复 Elastic Search 快照时出现 RepositoryException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27120131/