gpt4 book ai didi

elasticsearch - 如何备份和恢复 ElasticSearch

转载 作者:行者123 更新时间:2023-12-02 22:10:49 24 4
gpt4 key购买 nike

我一直在尝试使用以下方法将 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}

    最佳答案

    你正在创建你的 _snapshot/my_backup 就好了,你只需要添加一行到 /etc/elasticsearch/elasticsearch.yml :

    path.repo: ["/home/shawn/backup"]

    这是快照的实际位置。然后重启 Elasticsearch。

    关于elasticsearch - 如何备份和恢复 ElasticSearch,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42130222/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com