我正在使用Elasticsearch 1.4和ubuntu 12.04.3 LTS.Trying为Local elasticsearch创建快照。我引用此website
此网站的步骤在Windows Elasticsearch上正常运行。如果我在Ubuntu Elasticsearch上注册存储库。它被解雇了。
此查询我运行的内容
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
}
答案 0 :(得分:7)
首先创建一个备份文件夹(通常该文件夹创建用户主文件夹)
mkdir ~/backup
授予该文件夹
的权限chmod 777 ~/backup
创建存储库(存储库代表您的路径)
curl -XPUT http://xx.xx.xx.xx:9200/_snapshot/es_snap -d
'{"type":"fs","settings":{"location":"home/user/backup"
,"compress":true}}'
快照
curl -XPUT "http://xx.xx.xx.xx:9200/_snapshot/en_snap/snapshot_1" -d
'{"indices":["index1","index2","index3"],"ignore_unavailable":true,
"include_global_state": false,}'
恢复
curl -XPOST "http://xx.xx.xx.xx:9200/_snapshot/es_snap/snapshot_1/_restore" -d
'{"indices":["index1","index2"],"ignore_unavailable":true,
"include_global_state": false}'
答案 1 :(得分:1)
得到了同样的错误,我必须确保所有节点上的相同路径都是可写的(作为同一个用户)。我将目录直接挂载在其中一个节点上,并使用nfs挂载在其他节点上。要对perms进行故障排除,请编辑/ etc / passwd并将elasticsearch的登录shell从/ sbin / nolgin更改为/ bin / bash,然后运行'su - elasticsearch'。然后尝试将文件写入目录。您必须在所有节点上执行此操作。
答案 2 :(得分:0)
您的查询看起来不错。但是你是否拥有在&#34; / mount / backups / my_backup&#34;创建回购的适当权限?尝试使用curl命令作为sudo用户。值得一试!
我认为其权限问题的原因是您的错误日志中存在以下内容。 嵌套:BlobStoreException [无法在[/ mount / backups / my_backup]创建目录]; &#34;&#34;状态&#34; 500}