我一直在尝试以下方法来备份&将ElasticSearch集群从一台服务器还原到另一台服务器,但收效甚微。到目前为止我还没有使用备份过程,我想将整个ElasticSearch集群从一个小的2GB集群移动到15GB集群。我使用了以下方法。
使用taskrabit/elasticsearch-dump - 我已成功将整个数据库导出到backup.json文件,但是在恢复backup.json时,它给了我以下输出。在进一步研究输出之后,我了解到插件的批量输入尚未完全开发。
./bin/elasticdump --all=true --input=/home/user/backup.json --output=http://192.168.0.213:9200/ --type=data
Thu, 09 Feb 2017 06:43:29 GMT | starting dump
Thu, 09 Feb 2017 06:43:29 GMT | got 61 objects from source file (offset: 0)
Thu, 09 Feb 2017 06:43:29 GMT | sent 61 objects to destination elasticsearch, wrote 0
Thu, 09 Feb 2017 06:43:29 GMT | got 0 objects from source file (offset: 61)
Thu, 09 Feb 2017 06:43:29 GMT | Total Writes: 0
Thu, 09 Feb 2017 06:43:29 GMT | dump complete
使用elasticsearch-tools(es-export-bulk& es-import bulk)我再次成功备份了json。但导入再次失败并出现错误:
"statusCode":400,"response":"{"error":{
我使用了es-bulk-export
中的示例使用内置快照的ElasticSearch&恢复..
curl -XPUT 'http://localhost:9200/_snapshot/my_backup' -d '{
"type": "fs",
"settings": {"location": "/home/shawn/backup", "compress": true}
}'
我相信我遗漏了一些东西,因为执行会给我以下错误。我需要创建/_snapshot/my_backup
吗?如果是这样的话?
{"error":{"root_cause":[
{"type":"repository_exception",
"reason":"[my_backup] location [/home/shawn/backup] doesn't match any of the locations specified by path.repo because this setting is empty"
}],
"type":"repository_exception","reason":"[my_backup] failed to create repository",
"caused_by":
{"type":"creation_exception","reason":"Guice creation errors:\n\n1) Error injecting constructor, RepositoryException[[my_backup] location [/home/shawn/backup] doesn't match any of the locations specified by path.repo because this setting is empty]\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","caused_by":{"type":"repository_exception","reason":"[my_backup] location [/home/shawn/backup] doesn't match any of the locations specified by path.repo because this setting is empty"}}},"status":500}
答案 0 :(得分:0)
您正在创建_snapshot / my_backup,您只需要在 /etc/elasticsearch/elasticsearch.yml 中添加一行:
path.repo: ["/home/shawn/backup"]
快照的实际位置。然后重新启动Elasticsearch。
答案 1 :(得分:0)